Skip to content

Commit 9a8607b

Browse files
authored
chore: clear scim fields when deleting user + migration for existing cases (#9217)
1 parent a15d636 commit 9a8607b

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/lib/db/user-store.ts

+2
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ class UserStore implements IUserStore {
197197
deleted_at: new Date(),
198198
email: null,
199199
username: null,
200+
scim_id: null,
201+
scim_external_id: null,
200202
name: this.db.raw('name || ?', '(Deleted)'),
201203
});
202204
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
exports.up = (db, cb) => {
2+
db.runSql(`
3+
UPDATE users
4+
SET
5+
scim_id = NULL,
6+
scim_external_id = NULL
7+
WHERE deleted_at IS NOT NULL AND scim_id IS NOT NULL;
8+
`, cb);
9+
10+
};
11+
12+
exports.down = (db, cb) => {
13+
cb();
14+
};

0 commit comments

Comments
 (0)