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 SchemaConfig config) { getClient(SystemDefaults.SCHEMA).executeCommands(format("DROP DATABASE %s", config.getName())); addSchema(config); }