1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-01 00:08:27 +01:00
unleash.unleash/src/migrations/20230414105818-add-root-role-to-groups.js
Simon Hornby 3b42e866ec
feat: root roles from groups (#3559)
feat: adds a way to specify a root role on a group, which will cause any user entering into that group to take on the permissions of that root role

Co-authored-by: Nuno Góis <github@nunogois.com>
2023-04-20 12:29:30 +02:00

25 lines
582 B
JavaScript

'use strict';
exports.up = function (db, callback) {
db.runSql(
`
ALTER TABLE groups ADD COLUMN root_role_id INTEGER DEFAULT NULL;
ALTER TABLE groups
ADD CONSTRAINT fk_group_role_id
FOREIGN KEY(root_role_id)
REFERENCES roles(id);
`,
callback,
);
};
exports.down = function (db, callback) {
db.runSql(
`
ALTER TABLE groups DROP CONSTRAINT fk_group_role_id;
ALTER TABLE groups DROP COLUMN root_role_id;
`,
callback,
);
};