1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-04 00:18:01 +01:00
unleash.unleash/src/migrations/20240305131822-add-scim-id-column-to-user.js
Christopher Kolstad ca329da4b4
fix: scim id was not unique (#6450)
This PR drops the previous PRs scim_id idx and replaces it with an
actual UNIQUE index
2024-03-12 13:36:21 +01:00

14 lines
360 B
JavaScript

exports.up = function(db, cb) {
db.runSql(`
ALTER TABLE users ADD COLUMN scim_id TEXT;
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 IF EXISTS users_scim_id_uniq_idx;
ALTER TABLE users DROP COLUMN scim_id;
`, cb);
};