Skip to content

Commit

Permalink
fix: editor can add dependencies in default project
Browse files Browse the repository at this point in the history
  • Loading branch information
kwasniew committed Sep 4, 2024
1 parent 6540daf commit 6242654
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
exports.up = function (db, cb) {
db.runSql(
`
INSERT INTO role_permission (role_id, permission) SELECT id, 'UPDATE_FEATURE_DEPENDENCY' FROM roles WHERE name = 'Editor'
INSERT INTO role_permission (role_id, permission)
SELECT id, 'UPDATE_FEATURE_DEPENDENCY'
FROM roles WHERE name = 'Editor'
AND EXISTS (SELECT 1 FROM roles WHERE name = 'Editor')
AND NOT EXISTS (
SELECT 1
Expand All @@ -17,7 +19,9 @@ exports.up = function (db, cb) {
exports.down = function (db, cb) {
db.runSql(
`
DELETE FROM role_permission WHERE role_id = (SELECT id FROM roles WHERE name = 'Editor') AND permission = 'UPDATE_FEATURE_DEPENDENCY'
DELETE FROM role_permission
WHERE role_id = (SELECT id FROM roles WHERE name = 'Editor')
AND permission = 'UPDATE_FEATURE_DEPENDENCY'
AND EXISTS (SELECT 1 FROM roles WHERE name = 'Editor');
`,
cb
Expand Down

0 comments on commit 6242654

Please sign in to comment.