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:
parent
d4b9ca443c
commit
65ac2b2250
@ -6,7 +6,7 @@
|
|||||||
"rules": {},
|
"rules": {},
|
||||||
"settings": {},
|
"settings": {},
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"project": "../../tsconfig.json"
|
"project": "tsconfig.json"
|
||||||
},
|
},
|
||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
|
20
src/migrations/20220808110415-add-projects-foreign-key.js
Normal file
20
src/migrations/20220808110415-add-projects-foreign-key.js
Normal 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,
|
||||||
|
);
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user