Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR drops the previous PRs scim_id idx and replaces it with an actual UNIQUE index
- Loading branch information
Christopher Kolstad
committed
Mar 12, 2024
1 parent
74df643
commit ca329da
Showing
2 changed files
with
10 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
}; |