Commit 4ee367d
committed
[FIX] util: fix constraint removal in postgres 18
Since postgres 18 the not null on a field is an explicit constraint
named tablename_colname_not_null.
When trying to drop all constraint from a model, an error occurs when
trying to drop the id primary key not null constraint.
ALTER TABLE "mail_presence" DROP CONSTRAINT IF EXISTS "bus_presence_id_not_null"
ERROR: column "id" is in a primary key
This commit filters the constraints to remove the id not null one.
We may want to make this filter generic on all not null constraint1 parent ee04109 commit 4ee367d
1 file changed
+2
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1287 | 1287 | | |
1288 | 1288 | | |
1289 | 1289 | | |
| 1290 | + | |
1290 | 1291 | | |
1291 | 1292 | | |
1292 | 1293 | | |
1293 | 1294 | | |
1294 | 1295 | | |
1295 | 1296 | | |
1296 | | - | |
| 1297 | + | |
1297 | 1298 | | |
1298 | 1299 | | |
1299 | 1300 | | |
| |||
0 commit comments