Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update UIDs for provisioned users
  • Loading branch information
linoman committed Nov 4, 2025
commit a6a4533e7e4136d8251cd7b2b1b759626a28bda7
6 changes: 6 additions & 0 deletions pkg/services/sqlstore/migrations/user_mig.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,12 @@ func addUserMigrations(mg *Migrator) {
mg.AddMigration("Add index on user.is_service_account and user.last_seen_at", NewAddIndexMigration(userV2, &Index{
Cols: []string{"is_service_account", "last_seen_at"}, Type: IndexType,
}))

// Prefix SCIM UID for provisioned users to avoid numeric/existing-id collisions
mg.AddMigration("Prefix SCIM uid for provisioned users", NewRawSQLMigration("").
SQLite("UPDATE user SET uid = 'scim_' || uid WHERE is_provisioned = 1 AND uid NOT LIKE 'scim_%';").
Postgres("UPDATE `user` SET uid = 'scim_' || uid WHERE is_provisioned = TRUE AND uid NOT LIKE 'scim_%';").
Mysql("UPDATE user SET uid = CONCAT('scim_', uid) WHERE is_provisioned = 1 AND uid NOT LIKE 'scim_%';"))
}

const migSQLITEisServiceAccountNullable = `ALTER TABLE user ADD COLUMN tmp_service_account BOOLEAN DEFAULT 0;
Expand Down
Loading