-
-
Notifications
You must be signed in to change notification settings - Fork 736
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: editor can add dependencies in default project (#8077)
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
src/migrations/20240904084114-add-update-feature-dependency-editor.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
exports.up = function (db, cb) { | ||
db.runSql( | ||
` | ||
INSERT INTO role_permission (role_id, permission) | ||
SELECT id, 'UPDATE_FEATURE_DEPENDENCY' | ||
FROM roles WHERE name = 'Editor' AND type = 'root' | ||
AND EXISTS (SELECT 1 FROM roles WHERE name = 'Editor' and type = 'root') | ||
AND NOT EXISTS ( | ||
SELECT 1 | ||
FROM role_permission | ||
WHERE role_permission.role_id = (SELECT id FROM roles WHERE name = 'Editor' AND type = 'root') | ||
AND role_permission.permission = 'UPDATE_FEATURE_DEPENDENCY' | ||
); | ||
`, | ||
cb | ||
); | ||
}; | ||
|
||
exports.down = function (db, cb) { | ||
db.runSql( | ||
` | ||
DELETE FROM role_permission | ||
WHERE role_id = (SELECT id FROM roles WHERE name = 'Editor' AND type = 'root') | ||
AND permission = 'UPDATE_FEATURE_DEPENDENCY'; | ||
`, | ||
cb | ||
); | ||
}; |