1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-11-01 19:07:38 +01:00
unleash.unleash/src/migrations/20210913103159-api-keys-scoping.js
Ivar Conradi Østhus c4b697b57d
Feat/api key scoping (#941)
Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
2021-09-15 20:28:10 +02:00

20 lines
511 B
JavaScript

exports.up = function (db, cb) {
db.runSql(
`
ALTER TABLE api_tokens ADD COLUMN project VARCHAR REFERENCES PROJECTS(id) ON DELETE CASCADE;;
ALTER TABLE api_tokens ADD COLUMN environment VARCHAR REFERENCES environments(name) ON DELETE CASCADE;;
`,
cb,
);
};
exports.down = function (db, cb) {
db.runSql(
`
ALTER TABLE api_tokens DROP COLUMN project;
ALTER TABLE api_tokens DROP COLUMN environment;
`,
cb,
);
};