public void handler() {
}
@Override
protected void addChildren() throws OpsException {
DatabaseConnection dbConnection;
{
dbConnection = addChild(DatabaseConnection.build(model.server));
dbConnection.databaseName = model.databaseName;
// We need to run as superuser
// dbConnection.username = template.getAuthDatabaseUsername();
// dbConnection.password = template.getAuthDatabasePassword();
}
{
CreateDatabase db = dbConnection.addChild(CreateDatabase.class);
db.databaseName = model.databaseName;
}
{
CreateUser db = dbConnection.addChild(CreateUser.class);
db.grantDatabaseName = model.databaseName;
db.databaseUser = model.username;
db.databasePassword = model.password;
}
{
RunScript script = dbConnection.addChild(RunScript.class);
try {
script.sql = ResourceUtils.get(getClass(), "auth_schema.sql");
} catch (IOException e) {
throw new OpsException("Error loading SQL script resource", e);
}