1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-20 00:08:02 +01:00
unleash.unleash/src/migrations/20210830113948-connect-projects-to-global-envrionments.js

20 lines
556 B
JavaScript

exports.up = function (db, cb) {
db.runSql(
`SELECT id
FROM projects`,
(err, results) => {
results.rows.forEach((project) => {
db.runSql(
`INSERT INTO project_environments(project_id, environment_name) VALUES (?, ':global:') ON CONFLICT DO NOTHING;`,
[project.id],
);
});
cb();
},
);
};
exports.down = function (db, cb) {
db.runSql('DELETE FROM project_environments', cb);
};