engine/schema: call initDB before creating app context bean

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Rohit Yadav 2024-05-20 15:19:24 +05:30
parent 3883dbe9a0
commit 2f0f0e9ebc

View File

@ -116,10 +116,6 @@ public class DatabaseCreator {
}
public static void main(String[] args) {
ClassPathXmlApplicationContext appContext = new ClassPathXmlApplicationContext(new String[] {"/com/cloud/upgrade/databaseCreatorContext.xml"});
appContext.getBean(ComponentContext.class);
String dbPropsFile = "";
List<String> sqlFiles = new ArrayList<String>();
List<String> upgradeClasses = new ArrayList<String>();
@ -166,13 +162,17 @@ public class DatabaseCreator {
System.exit(1);
}
initDB(dbPropsFile, rootPassword, databases, dryRun);
ClassPathXmlApplicationContext appContext = new ClassPathXmlApplicationContext(new String[] {"/com/cloud/upgrade/databaseCreatorContext.xml"});
appContext.getBean(ComponentContext.class);
try {
TransactionLegacy.initDataSource(dbPropsFile);
} catch (IOException e) {
e.printStackTrace();
System.exit(1);
}
initDB(dbPropsFile, rootPassword, databases, dryRun);
// Process sql files
for (String sqlFile : sqlFiles) {