|
|
@ -53,6 +53,11 @@ public abstract class SqlAbstractDatabaseSchemaService implements DatabaseSchema |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void createDatabaseSchema() throws Exception { |
|
|
public void createDatabaseSchema() throws Exception { |
|
|
|
|
|
this.createDatabaseSchema(true); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void createDatabaseSchema(boolean createIndexes) throws Exception { |
|
|
|
|
|
|
|
|
log.info("Installing SQL DataBase schema part: " + schemaSql); |
|
|
log.info("Installing SQL DataBase schema part: " + schemaSql); |
|
|
|
|
|
|
|
|
@ -62,9 +67,15 @@ public abstract class SqlAbstractDatabaseSchemaService implements DatabaseSchema |
|
|
conn.createStatement().execute(sql); //NOSONAR, ignoring because method used to load initial thingsboard database schema
|
|
|
conn.createStatement().execute(sql); //NOSONAR, ignoring because method used to load initial thingsboard database schema
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (createIndexes) { |
|
|
|
|
|
this.createDatabaseIndexes(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void createDatabaseIndexes() throws Exception { |
|
|
if (schemaIdxSql != null) { |
|
|
if (schemaIdxSql != null) { |
|
|
log.info("Installing SQL DataBase schema indexes part: " + schemaIdxSql); |
|
|
log.info("Installing SQL DataBase schema indexes part: " + schemaIdxSql); |
|
|
|
|
|
|
|
|
Path schemaIdxFile = Paths.get(installScripts.getDataDir(), SQL_DIR, schemaIdxSql); |
|
|
Path schemaIdxFile = Paths.get(installScripts.getDataDir(), SQL_DIR, schemaIdxSql); |
|
|
try (Connection conn = DriverManager.getConnection(dbUrl, dbUserName, dbPassword)) { |
|
|
try (Connection conn = DriverManager.getConnection(dbUrl, dbUserName, dbPassword)) { |
|
|
String sql = new String(Files.readAllBytes(schemaIdxFile), Charset.forName("UTF-8")); |
|
|
String sql = new String(Files.readAllBytes(schemaIdxFile), Charset.forName("UTF-8")); |
|
|
|