use of org.platformlayer.ops.postgres.RunScript in project platformlayer by platformlayer.
the class GerritDatabaseController method addChildren.
@Override
protected void addChildren() throws OpsException {
GerritDatabaseTemplate template = injected(GerritDatabaseTemplate.class);
DatabaseConnection dbConnection;
{
dbConnection = addChild(DatabaseConnection.build(template.getDatabaseServerKey()));
dbConnection.databaseName = template.getDatabaseName();
}
{
CreateDatabase db = dbConnection.addChild(CreateDatabase.class);
db.databaseName = template.getDatabaseName();
}
{
CreateUser db = dbConnection.addChild(CreateUser.class);
db.grantDatabaseName = template.getDatabaseName();
db.databaseUser = template.getDatabaseUsername();
db.databasePassword = template.getDatabasePassword();
}
{
RunScript script = dbConnection.addChild(RunScript.class);
try {
script.sql = ResourceUtils.get(getClass(), "schema.sql");
} catch (IOException e) {
throw new OpsException("Error loading SQL script resource", e);
}
}
}
Aggregations