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

fix: scim id was not unique (#6450)

This PR drops the previous PRs scim_id idx and replaces it with an
actual UNIQUE index
This commit is contained in:
Christopher Kolstad 2024-03-12 13:36:21 +01:00 committed by GitHub
parent 74df643ce0
commit ca329da4b4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View File

@ -1,13 +1,13 @@
exports.up = function(db, cb) {
db.runSql(`
ALTER TABLE users ADD COLUMN scim_id TEXT;
CREATE INDEX users_scim_id_uniq_idx ON users (scim_id) WHERE scim_id IS NOT NULL;
CREATE INDEX IF NOT EXISTS users_scim_id_uniq_idx ON users (scim_id) WHERE scim_id IS NOT NULL;
`, cb);
};
exports.down = function(db, cb) {
db.runSql(`
DROP INDEX users_scim_id_uniq_idx;
DROP INDEX IF EXISTS users_scim_id_uniq_idx;
ALTER TABLE users DROP COLUMN scim_id;
`, cb);
};

View File

@ -0,0 +1,8 @@
exports.up = function(db, cb) {
db.runSql(`DROP INDEX IF EXISTS users_scim_id_uniq_idx;
CREATE UNIQUE INDEX users_scim_id_unique_idx ON users(scim_id) WHERE scim_id IS NOT NULL`, cb);
};
exports.down = function(db, cb) {
db.runSql(`DROP INDEX IF EXISTS users_scim_id_unique_idx;`, cb);
};