diff --git a/src/migrations/20210922084509-add-non-null-constraint-to-environment-type.js b/src/migrations/20210922084509-add-non-null-constraint-to-environment-type.js new file mode 100644 index 0000000000..4ea02d4486 --- /dev/null +++ b/src/migrations/20210922084509-add-non-null-constraint-to-environment-type.js @@ -0,0 +1,14 @@ +'use strict'; + +exports.up = function (db, cb) { + db.runSql( + ` + UPDATE environments SET type = 'production' WHERE type IS null; + ALTER TABLE environments ALTER COLUMN type SET NOT NULL`, + cb, + ); +}; + +exports.down = function (db, cb) { + db.runSql(`ALTER TABLE environments ALTER COLUMN type DROP NOT NULL`, cb); +}; diff --git a/src/test/e2e/api/client/metrics.e2e.access.e2e.test.ts b/src/test/e2e/api/client/metrics.e2e.access.e2e.test.ts index 347fa7b6da..d2b12b0d57 100644 --- a/src/test/e2e/api/client/metrics.e2e.access.e2e.test.ts +++ b/src/test/e2e/api/client/metrics.e2e.access.e2e.test.ts @@ -8,7 +8,7 @@ let app; let db; beforeAll(async () => { - db = await dbInit('metrics_api_client', getLogger); + db = await dbInit('metrics_api_e2e_access_client', getLogger); app = await setupAppWithAuth(db.stores); });