1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
unleash.unleash/src/migrations/20211126112551-disable-default-environment.js

28 lines
762 B
JavaScript
Raw Normal View History

exports.up = function (db, cb) {
db.runSql(
`
UPDATE environments
SET enabled = false
WHERE name = 'default'
AND NOT EXISTS (select * from features);
DELETE FROM project_environments
WHERE environment_name = 'default'
AND NOT EXISTS (select * from features);
INSERT INTO project_environments(project_id, environment_name)
SELECT 'default', 'development'
WHERE NOT EXISTS (select * from features);
INSERT INTO project_environments(project_id, environment_name)
SELECT 'default', 'production'
WHERE NOT EXISTS (select * from features);
`,
cb,
);
};
exports.down = function (db, cb) {
db.runSql('', cb);
};