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

25 lines
582 B
JavaScript
Raw Normal View History

'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,
);
};