DB migration initial

This commit is contained in:
Robin Bygrave
2015-08-04 23:23:32 +12:00
parent 009f91b949
commit 22407506ff
25 changed files with 2844 additions and 382 deletions
@@ -21,7 +21,7 @@ public class BaseDdlHandlerTest extends BaseTestCase {
private BaseDdlHandler h2Handler() {
DbTypeMap types = new H2Platform().getDbTypeMap();
return new BaseDdlHandler(new DdlNamingConvention(), new H2Ddl(types));
return new BaseDdlHandler(new DdlNamingConvention(), new H2Ddl(types, true));
}
private BaseDdlHandler postgresHandler() {
@@ -18,7 +18,7 @@ public class BaseTableDdlTest {
@Test
public void testGenerate() throws Exception {
BaseTableDdl ddlGen = new BaseTableDdl(new DdlNamingConvention(), new H2Ddl(new DbTypeMap()));
BaseTableDdl ddlGen = new BaseTableDdl(new DdlNamingConvention(), new H2Ddl(new DbTypeMap(), true));
DdlWrite write = new DdlWrite();
@@ -14,7 +14,7 @@ public class MigrationXmlWriterTest {
@Test
public void testWrite() throws Exception {
Migration migration = MigrationXmlReader.read("/test/container/test-create-table.xml");
Migration migration = MigrationXmlReader.read("/container/test-create-table.xml");
File temp = File.createTempFile("migrationWrite",".xml");
MigrationXmlWriter writer = new MigrationXmlWriter();
@@ -17,7 +17,7 @@ public class ModelContainerApplyTest {
@Test
public void testApply() throws Exception {
Migration migration = MigrationXmlReader.read("/test/container/test-create-table.xml");
Migration migration = MigrationXmlReader.read("/container/test-create-table.xml");
List<ChangeSet> changeSets = migration.getChangeSet();
ChangeSet changeSet = changeSets.get(0);
@@ -25,9 +25,14 @@ public class ModelBuildBeanVisitorTest extends BaseTestCase {
new VisitAllUsing(addTable, defaultServer).visitAllBeans();
MTable item = model.getTable("item");
assertThat(item).isNotNull();
assertThat(item.primaryKeyColumns()).hasSize(2);
MTable customer = model.getTable("o_customer");
assertThat(customer).isNotNull();
assertThat(customer.getSequenceName()).isNotNull();
}
}