mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
DbMigration supports altering UniqueConstraints and foreign keys (#1279)
* NEW: Ebean reads version from pop.properties and prints it at start up * DDL generation and migration can append a header and platformMigration is prepared to append epilog & prolog to scripts * FIX: Set identity only, if it is not the platform default type * Updated reference scripts * ADD basic support for foreign key migration * DbMigration detects alter foreign keys * tests
This commit is contained in:
committed by
Rob Bygrave
parent
a64a244745
commit
da7bb834e7
@@ -6,7 +6,9 @@ import io.ebeaninternal.dbmigration.ddlgeneration.platform.PlatformDdl;
|
||||
import io.ebeaninternal.dbmigration.migration.AddColumn;
|
||||
import io.ebeaninternal.dbmigration.migration.AddHistoryTable;
|
||||
import io.ebeaninternal.dbmigration.migration.AddTableComment;
|
||||
import io.ebeaninternal.dbmigration.migration.AddUniqueConstraint;
|
||||
import io.ebeaninternal.dbmigration.migration.AlterColumn;
|
||||
import io.ebeaninternal.dbmigration.migration.AlterForeignKey;
|
||||
import io.ebeaninternal.dbmigration.migration.ChangeSet;
|
||||
import io.ebeaninternal.dbmigration.migration.CreateIndex;
|
||||
import io.ebeaninternal.dbmigration.migration.CreateTable;
|
||||
@@ -59,6 +61,10 @@ public class BaseDdlHandler implements DdlHandler {
|
||||
generate(writer, (AddHistoryTable) change);
|
||||
} else if (change instanceof DropHistoryTable) {
|
||||
generate(writer, (DropHistoryTable) change);
|
||||
} else if (change instanceof AddUniqueConstraint) {
|
||||
generate(writer, (AddUniqueConstraint) change);
|
||||
} else if (change instanceof AlterForeignKey) {
|
||||
generate(writer, (AlterForeignKey) change);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unsupported change: " + change);
|
||||
}
|
||||
@@ -125,4 +131,13 @@ public class BaseDdlHandler implements DdlHandler {
|
||||
tableDdl.generate(writer, dropIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate(DdlWrite writer, AddUniqueConstraint constraint) throws IOException {
|
||||
tableDdl.generate(writer, constraint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate(DdlWrite writer, AlterForeignKey alterForeignKey) throws IOException {
|
||||
tableDdl.generate(writer, alterForeignKey);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user