mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-14 06:45:21 +00:00
Append preconfigured database to dbMigration (#1291)
This commit is contained in:
1 parent
bb418456e3
commit
83cf768369
3 files changed
+21
-1
No files matched your search
@@ -102,6 +102,14 @@ public interface DbMigration {
|
||||
*/
|
||||
void addPlatform(Platform platform, String prefix);
|
||||
|
||||
/**
|
||||
* Add an additional databasePlatform to write the migration DDL.
|
||||
* <p>
|
||||
* Use this when you want to add preconfigured database platforms.
|
||||
* </p>
|
||||
*/
|
||||
void addDatabasePlatform(DatabasePlatform databasePlatform, String prefix);
|
||||
|
||||
/**
|
||||
* Generate the next migration xml file and associated apply and rollback sql scripts.
|
||||
* <p>
|
||||
|
||||
@@ -183,6 +183,11 @@ public class DefaultDbMigration implements DbMigration {
|
||||
platforms.add(new Pair(getPlatform(platform), prefix));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDatabasePlatform(DatabasePlatform databasePlatform, String prefix) {
|
||||
platforms.add(new Pair(databasePlatform, prefix));
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the next migration xml file and associated apply and rollback sql scripts.
|
||||
* <p>
|
||||
|
||||
@@ -4,6 +4,9 @@ import io.ebean.EbeanServer;
|
||||
import io.ebean.EbeanServerFactory;
|
||||
import io.ebean.annotation.Platform;
|
||||
import io.ebean.config.ServerConfig;
|
||||
import io.ebean.config.dbplatform.DatabasePlatform;
|
||||
import io.ebean.config.dbplatform.IdType;
|
||||
import io.ebean.config.dbplatform.sqlserver.SqlServerPlatform;
|
||||
|
||||
import org.junit.*;
|
||||
import org.slf4j.Logger;
|
||||
@@ -52,7 +55,11 @@ public class DbMigrationGenerateTest {
|
||||
migration.addPlatform(Platform.POSTGRES, "postgres");
|
||||
migration.addPlatform(Platform.ORACLE, "oracle");
|
||||
migration.addPlatform(Platform.SQLITE, "sqlite");
|
||||
migration.addPlatform(Platform.SQLSERVER, "sqlserver");
|
||||
|
||||
// we need sequence here, so that migration will work properly
|
||||
DatabasePlatform sqlServer = new SqlServerPlatform();
|
||||
sqlServer.getDbIdentity().setIdType(IdType.SEQUENCE);
|
||||
migration.addDatabasePlatform(sqlServer, "sqlserver");
|
||||
|
||||
ServerConfig config = new ServerConfig();
|
||||
config.setName("migrationtest");
|
||||
|
||||
Reference in new issue
Block a user