diff --git a/jOOQ/src/main/java/org/jooq/conf/Settings.java b/jOOQ/src/main/java/org/jooq/conf/Settings.java index 9cd213eea4..8cd506d720 100644 --- a/jOOQ/src/main/java/org/jooq/conf/Settings.java +++ b/jOOQ/src/main/java/org/jooq/conf/Settings.java @@ -207,6 +207,8 @@ public class Settings @XmlJavaTypeAdapter(LocaleAdapter.class) protected Locale interpreterLocale; @XmlElement(defaultValue = "false") + protected Boolean interpreterDelayForeignKeyDeclarations = false; + @XmlElement(defaultValue = "false") protected Boolean migrationAllowsUndo = false; @XmlElement(defaultValue = "false") protected Boolean migrationRevertUntracked = false; @@ -1773,6 +1775,30 @@ public class Settings this.interpreterLocale = value; } + /** + * Using this flag, the interpreter will be able to delay the addition of foreign key declarations until the end of the interpretation run. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isInterpreterDelayForeignKeyDeclarations() { + return interpreterDelayForeignKeyDeclarations; + } + + /** + * Sets the value of the interpreterDelayForeignKeyDeclarations property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setInterpreterDelayForeignKeyDeclarations(Boolean value) { + this.interpreterDelayForeignKeyDeclarations = value; + } + /** * Whether migrations are allowed to be executed in inverse order.
This is a potentially destructive feature, which should not be turned on in production. It is useful mostly to quickly switch between branches in a development environment. This feature is available only in commercial distributions.
*
@@ -2597,6 +2623,11 @@ public class Settings
return this;
}
+ public Settings withInterpreterDelayForeignKeyDeclarations(Boolean value) {
+ setInterpreterDelayForeignKeyDeclarations(value);
+ return this;
+ }
+
public Settings withMigrationAllowsUndo(Boolean value) {
setMigrationAllowsUndo(value);
return this;
@@ -2812,6 +2843,7 @@ public class Settings
builder.append("interpreterDialect", interpreterDialect);
builder.append("interpreterNameLookupCaseSensitivity", interpreterNameLookupCaseSensitivity);
builder.append("interpreterLocale", interpreterLocale);
+ builder.append("interpreterDelayForeignKeyDeclarations", interpreterDelayForeignKeyDeclarations);
builder.append("migrationAllowsUndo", migrationAllowsUndo);
builder.append("migrationRevertUntracked", migrationRevertUntracked);
builder.append("migrationAutoValidation", migrationAutoValidation);
@@ -3478,6 +3510,15 @@ public class Settings
return false;
}
}
+ if (interpreterDelayForeignKeyDeclarations == null) {
+ if (other.interpreterDelayForeignKeyDeclarations!= null) {
+ return false;
+ }
+ } else {
+ if (!interpreterDelayForeignKeyDeclarations.equals(other.interpreterDelayForeignKeyDeclarations)) {
+ return false;
+ }
+ }
if (migrationAllowsUndo == null) {
if (other.migrationAllowsUndo!= null) {
return false;
@@ -3690,6 +3731,7 @@ public class Settings
result = ((prime*result)+((interpreterDialect == null)? 0 :interpreterDialect.hashCode()));
result = ((prime*result)+((interpreterNameLookupCaseSensitivity == null)? 0 :interpreterNameLookupCaseSensitivity.hashCode()));
result = ((prime*result)+((interpreterLocale == null)? 0 :interpreterLocale.hashCode()));
+ result = ((prime*result)+((interpreterDelayForeignKeyDeclarations == null)? 0 :interpreterDelayForeignKeyDeclarations.hashCode()));
result = ((prime*result)+((migrationAllowsUndo == null)? 0 :migrationAllowsUndo.hashCode()));
result = ((prime*result)+((migrationRevertUntracked == null)? 0 :migrationRevertUntracked.hashCode()));
result = ((prime*result)+((migrationAutoValidation == null)? 0 :migrationAutoValidation.hashCode()));
diff --git a/jOOQ/src/main/java/org/jooq/impl/Interpreter.java b/jOOQ/src/main/java/org/jooq/impl/Interpreter.java
index e99940cb1b..c6693361bc 100644
--- a/jOOQ/src/main/java/org/jooq/impl/Interpreter.java
+++ b/jOOQ/src/main/java/org/jooq/impl/Interpreter.java
@@ -37,6 +37,7 @@
*/
package org.jooq.impl;
+import static java.lang.Boolean.TRUE;
import static org.jooq.Name.Quoted.QUOTED;
import static org.jooq.conf.SettingsTools.interpreterLocale;
import static org.jooq.impl.AbstractName.NO_NAME;
@@ -54,8 +55,10 @@ import static org.jooq.impl.Tools.reverseIterable;
import static org.jooq.tools.StringUtils.defaultIfNull;
import java.util.AbstractList;
+import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Deque;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
@@ -113,6 +116,8 @@ final class Interpreter {
private final MutableCatalog defaultCatalog;
private final MutableSchema defaultSchema;
private MutableSchema currentSchema;
+ private boolean delayForeignKeyDeclarations;
+ private final Deque