1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
unleash.unleash/src/migrations/20220528143630-dont-cascade-environment-deletion-to-apitokens.js
Dennis Szczepanski 7ead887147
fix: Issue #1444 - API import with drop=true deletes existing client keys (#1668)
* fix: Does not delete api_tokens on drop-Import

* feat: Cleans unused apiTokens on environment import

* refactor: Moves ALL_PROJECTS and ALL_ENVIRONMENTS to constants

* refactor: Renames migration 20220528143630 for a more precise name

* refactor: Removes unecessary console.log

* fix: Adds correct down-script for migration 20220528143630
2022-06-09 15:56:13 +01:00

20 lines
424 B
JavaScript

'use strict';
exports.up = function (db, cb) {
db.runSql(
`
ALTER TABLE api_tokens DROP CONSTRAINT api_tokens_environment_fkey;
`,
cb,
);
};
exports.down = function (db, cb) {
db.runSql(
`
ALTER TABLE api_tokens ADD CONSTRAINT api_tokens_environment_fkey FOREIGN KEY(environment) REFERENCES environments(name) ON DELETE CASCADE;
`,
cb,
);
};