1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

task: added migration for scim_external_id (#6966)

This commit is contained in:
Christopher Kolstad 2024-04-30 10:24:17 +02:00 committed by GitHub
parent 979220d80d
commit 7754ac69df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -0,0 +1,23 @@
exports.up = function (db, cb) {
db.runSql(
`
ALTER TABLE users ADD COLUMN scim_external_id TEXT;
ALTER TABLE groups ADD COLUMN scim_external_id TEXT;
CREATE UNIQUE INDEX users_scim_external_id_uniq_idx on users(scim_external_id) WHERE scim_external_id IS NOT NULL;
CREATE UNIQUE INDEX groups_scim_external_id_uniq_idx ON groups(scim_external_id) WHERE scim_external_id IS NOT NULL;
`,
cb,
);
};
exports.down = function (db, cb) {
db.runSql(
`
DROP INDEX IF EXISTS users_scim_external_id_uniq_idx;
DROP INDEX IF EXISTS groups_scim_external_id_uniq_idx;
ALTER TABLE groups DROP COLUMN scim_external_id;
ALTER TABLE users DROP COLUMN scim_external_id;
`,
cb,
);
};