-
-
Notifications
You must be signed in to change notification settings - Fork 664
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
task: added migration for scim_external_id (#6966)
- Loading branch information
Showing
1 changed file
with
23 additions
and
0 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 |
---|---|---|
@@ -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, | ||
); | ||
}; |