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:
parent
74df643ce0
commit
ca329da4b4
@ -1,13 +1,13 @@
|
|||||||
exports.up = function(db, cb) {
|
exports.up = function(db, cb) {
|
||||||
db.runSql(`
|
db.runSql(`
|
||||||
ALTER TABLE users ADD COLUMN scim_id TEXT;
|
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);
|
`, cb);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.down = function(db, cb) {
|
exports.down = function(db, cb) {
|
||||||
db.runSql(`
|
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;
|
ALTER TABLE users DROP COLUMN scim_id;
|
||||||
`, cb);
|
`, cb);
|
||||||
};
|
};
|
||||||
|
8
src/migrations/20240306145609-make-scim-id-idx-unique.js
Normal file
8
src/migrations/20240306145609-make-scim-id-idx-unique.js
Normal 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);
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user