mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#2403 - table partitioning (Postgres only at this point) is always included + simplify skip logic
This commit is contained in:
@@ -212,7 +212,7 @@ public class DdlGenerator implements SpiDdlGenerator {
|
||||
if (extraDdl && jaxbPresent) {
|
||||
if (currentModel().isTablePartitioning()) {
|
||||
String extraPartitioning = ExtraDdlXmlReader.buildPartitioning(platform);
|
||||
if (extraPartitioning != null && !extraPartitioning.isEmpty() && useMigrationStoredProcedures) {
|
||||
if (extraPartitioning != null && !extraPartitioning.isEmpty()) {
|
||||
runScript(connection, false, extraPartitioning, "builtin-partitioning-ddl");
|
||||
}
|
||||
}
|
||||
|
||||
+4
-7
@@ -397,23 +397,20 @@ public class DefaultDbMigration implements DbMigration {
|
||||
private void generateExtraDdl(File migrationDir, DatabasePlatform dbPlatform, boolean tablePartitioning) throws IOException {
|
||||
if (dbPlatform != null) {
|
||||
if (tablePartitioning && includeBuiltInPartitioning) {
|
||||
generateExtraDdlFor(migrationDir, dbPlatform, ExtraDdlXmlReader.readBuiltinTablePartitioning(), true);
|
||||
generateExtraDdlFor(migrationDir, dbPlatform, ExtraDdlXmlReader.readBuiltinTablePartitioning(), false);
|
||||
}
|
||||
// skip built-in migration stored procedures based on isUseMigrationStoredProcedures
|
||||
generateExtraDdlFor(migrationDir, dbPlatform, ExtraDdlXmlReader.readBuiltin(), true);
|
||||
generateExtraDdlFor(migrationDir, dbPlatform, ExtraDdlXmlReader.read(), false);
|
||||
}
|
||||
}
|
||||
|
||||
private void generateExtraDdlFor(File migrationDir, DatabasePlatform dbPlatform, ExtraDdl extraDdl, boolean isBuiltin) throws IOException {
|
||||
private void generateExtraDdlFor(File migrationDir, DatabasePlatform dbPlatform, ExtraDdl extraDdl, boolean checkSkip) throws IOException {
|
||||
if (extraDdl != null) {
|
||||
List<DdlScript> ddlScript = extraDdl.getDdlScript();
|
||||
for (DdlScript script : ddlScript) {
|
||||
if (!script.isDrop() && matchPlatform(dbPlatform.getPlatform(), script.getPlatforms())) {
|
||||
if (script.isInit()) {
|
||||
if (!isBuiltin || dbPlatform.isUseMigrationStoredProcedures()) {
|
||||
writeExtraDdl(migrationDir, script);
|
||||
}
|
||||
} else {
|
||||
if (!checkSkip || dbPlatform.isUseMigrationStoredProcedures()) {
|
||||
writeExtraDdl(migrationDir, script);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user