1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-10 17:53:36 +02:00

Add constraint for project

This commit is contained in:
sjaanus 2022-08-08 12:16:41 +00:00
parent d4b9ca443c
commit 65ac2b2250
2 changed files with 21 additions and 1 deletions

View File

@ -6,7 +6,7 @@
"rules": {},
"settings": {},
"parserOptions": {
"project": "../../tsconfig.json"
"project": "tsconfig.json"
},
"overrides": [
{

View File

@ -0,0 +1,20 @@
exports.up = function (db, cb) {
db.runSql(
`
delete from group_role where project not in (select id from projects);
ALTER TABLE group_role
ADD CONSTRAINT fk_group_role_project
FOREIGN KEY(project)
REFERENCES projects(id) ON DELETE CASCADE; `,
cb,
);
};
exports.down = function (db, cb) {
db.runSql(
`
ALTER TABLE group_role DROP CONSTRAINT fk_group_role_project;
`,
cb,
);
};