Skip to content

Commit

Permalink
Fix extensions migrations path (open-metadata#13541)
Browse files Browse the repository at this point in the history
* Fix extensions migrations path

* Fix extensionPath for migrations

* Fix extensionPath for migrations

* Fix bootstrap echo
  • Loading branch information
harshach authored Oct 12, 2023
1 parent 48a892c commit f3adafd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
3 changes: 1 addition & 2 deletions bootstrap/bootstrap_storage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit f3adafd

Please sign in to comment.