mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
1-3131: db migration to make potentially stale non-nullable (#8796)
This change adds a db migration to make the potentially_stale column non-nullable. It'll set any NULL values to `false`. In the down-migration, make the column nullable again.
This commit is contained in:
parent
9d96052a3b
commit
82e752be45
@ -0,0 +1,29 @@
|
||||
'use strict';
|
||||
|
||||
exports.up = function (db, cb) {
|
||||
db.runSql(
|
||||
`
|
||||
UPDATE features
|
||||
SET potentially_stale = FALSE
|
||||
WHERE potentially_stale IS NULL;
|
||||
|
||||
ALTER TABLE features
|
||||
ALTER COLUMN potentially_stale SET DEFAULT FALSE;
|
||||
ALTER TABLE features
|
||||
ALTER COLUMN potentially_stale SET NOT NULL;
|
||||
`,
|
||||
cb
|
||||
);
|
||||
};
|
||||
|
||||
exports.down = function (db, cb) {
|
||||
db.runSql(
|
||||
`
|
||||
ALTER TABLE features
|
||||
ALTER COLUMN potentially_stale DROP DEFAULT;
|
||||
ALTER TABLE features
|
||||
ALTER COLUMN potentially_stale DROP NOT NULL;
|
||||
`,
|
||||
cb
|
||||
);
|
||||
};
|
Loading…
Reference in New Issue
Block a user