private EmbeddedMysql addSchema(final SchemaConfig schema) { Charset effectiveCharset = schema.getCharset().or(config.getCharset()); getClient(SystemDefaults.SCHEMA) .executeCommands( format( "CREATE DATABASE %s CHARACTER SET = %s COLLATE = %s;", schema.getName(), effectiveCharset.getCharset(), effectiveCharset.getCollate()), format("GRANT ALL ON %s.* TO '%s'@'%%';", schema.getName(), config.getUsername())); getClient(schema.getName()).executeScripts(schema.getScripts()); return this; }
public void reloadSchema(final String schemaName, final List<File> scripts) { reloadSchema(SchemaConfig.aSchemaConfig(schemaName).withScripts(scripts).build()); }
public void reloadSchema(final SchemaConfig config) { getClient(SystemDefaults.SCHEMA).executeCommands(format("DROP DATABASE %s", config.getName())); addSchema(config); }
public Builder addSchema(final String name, final List<File> scripts) { this.schemas.add(SchemaConfig.aSchemaConfig(name).withScripts(scripts).build()); return this; }