Skip to content

Commit

Permalink
1-3131: db migration to make potentially stale non-nullable
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
thomasheartman committed Nov 19, 2024
1 parent 18591dd commit 16cff28
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'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 NOT NULL;
`,
cb,
);
};

exports.down = function (db, cb) {
db.runSql(
`
ALTER TABLE features ALTER COLUMN potentially_stale DROP NOT NULL;
`,
cb,
);
};

0 comments on commit 16cff28

Please sign in to comment.