diff --git a/bootstrap/bootstrap_storage.sh b/bootstrap/bootstrap_storage.sh index 323cc528c435..7aafb9692cb6 100755 --- a/bootstrap/bootstrap_storage.sh +++ b/bootstrap/bootstrap_storage.sh @@ -33,7 +33,6 @@ done BOOTSTRAP_DIR=`dirname ${PRG}` CONFIG_FILE_PATH=${BOOTSTRAP_DIR}/../conf/openmetadata.yaml -FLYWAY_SQL_ROOT_DIR="${BOOTSTRAP_DIR}/sql/migrations/flyway" NATIVE_SQL_ROOT_DIR="${BOOTSTRAP_DIR}/sql/migrations/native" # Which java to use @@ -61,7 +60,7 @@ execute() { if [ ${debug} ] ; then echo "Using Configuration file: ${CONFIG_FILE_PATH}" fi - ${JAVA} -Dbootstrap.dir=$BOOTSTRAP_DIR -cp ${CLASSPATH} ${TABLE_INITIALIZER_MAIN_CLASS} -c ${CONFIG_FILE_PATH} -s ${FLYWAY_SQL_ROOT_DIR} -n ${NATIVE_SQL_ROOT_DIR} --${1} -force ${force} -${debug} + ${JAVA} -Dbootstrap.dir=$BOOTSTRAP_DIR -cp ${CLASSPATH} ${TABLE_INITIALIZER_MAIN_CLASS} -c ${CONFIG_FILE_PATH} --${1} -force ${force} -${debug} } printUsage() { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/util/TablesInitializer.java b/openmetadata-service/src/main/java/org/openmetadata/service/util/TablesInitializer.java index ee677eff30bb..bd8a9d8cc5aa 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/util/TablesInitializer.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/util/TablesInitializer.java @@ -70,10 +70,6 @@ public final class TablesInitializer { static { OPTIONS = new Options(); OPTIONS.addOption("debug", DEBUG_MODE_ENABLED, false, "Enable Debug Mode"); - OPTIONS.addOption("s", OPTION_FLYWAY_SCRIPT_ROOT_PATH, true, "Root directory of flyway sql script path"); - OPTIONS.addOption("n", OPTION_NATIVE_SQL_ROOT_PATH, true, "Root directory of native sql script path"); - OPTIONS.addOption("e", OPTION_EXTENSION_SQL_ROOT_PATH, true, "Root directory for extension migrations to execute"); - OPTIONS.addOption("c", OPTION_CONFIG_FILE_PATH, true, "Config file path"); OPTIONS.addOption( OPTION_FORCE_MIGRATIONS, @@ -119,12 +115,6 @@ private TablesInitializer() {} public static void main(String[] args) throws Exception { CommandLineParser parser = new DefaultParser(); CommandLine commandLine = parser.parse(OPTIONS, args); - if (!commandLine.hasOption(OPTION_CONFIG_FILE_PATH) - || !commandLine.hasOption(OPTION_NATIVE_SQL_ROOT_PATH) - || !commandLine.hasOption(OPTION_FLYWAY_SCRIPT_ROOT_PATH)) { - usage(); - System.exit(1); - } if (commandLine.hasOption(DEBUG_MODE_ENABLED)) { debugMode = true; } @@ -204,15 +194,15 @@ public static void main(String[] args) throws Exception { if (disableValidateOnMigrate) { printToConsoleInDebug("Disabling validation on schema migrate"); } - String nativeSQLScriptRootPath = commandLine.getOptionValue(OPTION_NATIVE_SQL_ROOT_PATH); - String scriptRootPath = commandLine.getOptionValue(OPTION_FLYWAY_SCRIPT_ROOT_PATH); - String extensionSQLScriptRootPath = commandLine.getOptionValue(OPTION_EXTENSION_SQL_ROOT_PATH); + String nativeSQLScriptRootPath = config.getMigrationConfiguration().getNativePath(); + String flywayRootPath = config.getMigrationConfiguration().getFlywayPath(); + String extensionSQLScriptRootPath = config.getMigrationConfiguration().getExtensionPath(); Flyway flyway = get( jdbcUrl, user, password, - scriptRootPath, + flywayRootPath, config.getDataSourceFactory().getDriverClass(), !disableValidateOnMigrate); try {