[jOOQ/jOOQ#18450] Diff should drop PRIMARY KEY first, then NOT NULL constraint
This commit is contained in:
parent
f1d983d40d
commit
35b7961c75
@ -981,14 +981,20 @@ final class Diff {
|
||||
|
||||
// [#18044] DROP CONSTRAINT / INDEX before everything, ADD CONSTRAINT / INDEX after everything
|
||||
// [#18383] FOREIGN KEY must be dropped before other constraints, or added after other constraints
|
||||
// [#18450] DROP NOT NULL must happen after dropping constraints, SET NOT NULL before adding constraints
|
||||
if (q instanceof AlterTableImpl a) {
|
||||
return a.$dropConstraint() instanceof QOM.ForeignKey || a.$dropConstraintType() == FOREIGN_KEY
|
||||
return
|
||||
a.$dropConstraint() instanceof QOM.ForeignKey || a.$dropConstraintType() == FOREIGN_KEY
|
||||
? -3
|
||||
: a.$dropConstraint() != null || a.$dropConstraintType() != null
|
||||
? -2
|
||||
: a.$dropConstraint() != null
|
||||
: a.$alterColumnNullability() == Nullability.NULL
|
||||
? -1
|
||||
: a.$addConstraint() instanceof QOM.ForeignKey || a.$dropConstraintType() == FOREIGN_KEY
|
||||
? 2
|
||||
? 3
|
||||
: a.$addConstraint() != null
|
||||
? 2
|
||||
: a.$alterColumnNullability() == Nullability.NOT_NULL
|
||||
? 1
|
||||
: 0;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user