diff --git a/src/migrations/20251002095623-not-null-constraints.js b/src/migrations/20251002095623-not-null-constraints.js new file mode 100644 index 0000000000..782edbf779 --- /dev/null +++ b/src/migrations/20251002095623-not-null-constraints.js @@ -0,0 +1,19 @@ +exports.up = function (db) { + return db.runSql(` + UPDATE feature_strategies + SET constraints = '[]'::jsonb + WHERE constraints IS NULL; + + ALTER TABLE feature_strategies + ALTER COLUMN constraints SET DEFAULT '[]'::jsonb, + ALTER COLUMN constraints SET NOT NULL; + `); +}; + +exports.down = function (db) { + return db.runSql(` + ALTER TABLE feature_strategies + ALTER COLUMN constraints DROP DEFAULT, + ALTER COLUMN constraints DROP NOT NULL; + `); +}; \ No newline at end of file