Collect the DB schemas in the model via MTable

This commit is contained in:
rob bygrave
2020-02-21 17:16:28 +13:00
parent e4390ed8a2
commit ea490a5ac3
4 changed files with 49 additions and 4 deletions
@@ -10,6 +10,7 @@ import io.ebeaninternal.dbmigration.migrationreader.MigrationXmlReader;
import org.junit.Test;
import java.util.List;
import java.util.Set;
import static org.assertj.core.api.Assertions.assertThat;
@@ -153,6 +154,22 @@ public class ModelContainerTest {
container.applyChange(dropHistoryTable);
}
@Test
public void getSchemas() {
MTable t0 = new MTable("foo.one");
MTable t1 = new MTable("foo.two");
MTable t2 = new MTable("bar.three");
ModelContainer container = new ModelContainer();
container.addTable(t0);
container.addTable(t1);
container.addTable(t2);
final Set<String> schemas = container.getSchemas();
assertThat(schemas).containsExactly("bar","foo");
}
private ModelContainer container_2_1() {
ModelContainer container = new ModelContainer();
container.apply(mig("2.0.model.xml"), ver("2.0"));