diff --git a/server/migrations/20260421100010_add_desktop_fields_to_platform_accounts.up.sql b/server/migrations/20260421100010_add_desktop_fields_to_platform_accounts.up.sql index 40eec4f..1ddc512 100644 --- a/server/migrations/20260421100010_add_desktop_fields_to_platform_accounts.up.sql +++ b/server/migrations/20260421100010_add_desktop_fields_to_platform_accounts.up.sql @@ -53,7 +53,7 @@ CREATE UNIQUE INDEX IF NOT EXISTS uniq_platform_accounts_desktop_id ON platform_accounts (desktop_id); CREATE UNIQUE INDEX IF NOT EXISTS uniq_platform_accounts_workspace_identity_active - ON platform_accounts (workspace_id, platform_id, platform_uid) + ON platform_accounts (workspace_id, client_id, platform_id, platform_uid) WHERE deleted_at IS NULL; CREATE INDEX IF NOT EXISTS idx_platform_accounts_client_id diff --git a/server/migrations/20260506120000_scope_platform_accounts_to_desktop_client.down.sql b/server/migrations/20260506120000_scope_platform_accounts_to_desktop_client.down.sql index 258a6b4..b26f60a 100644 --- a/server/migrations/20260506120000_scope_platform_accounts_to_desktop_client.down.sql +++ b/server/migrations/20260506120000_scope_platform_accounts_to_desktop_client.down.sql @@ -1,5 +1,6 @@ +DROP INDEX IF EXISTS uk_platform_accounts_identity_active; DROP INDEX IF EXISTS uniq_platform_accounts_workspace_identity_active; CREATE UNIQUE INDEX IF NOT EXISTS uniq_platform_accounts_workspace_identity_active - ON platform_accounts (workspace_id, platform_id, platform_uid) + ON platform_accounts (workspace_id, client_id, platform_id, platform_uid) WHERE deleted_at IS NULL; diff --git a/server/migrations/20260506120000_scope_platform_accounts_to_desktop_client.up.sql b/server/migrations/20260506120000_scope_platform_accounts_to_desktop_client.up.sql index f324915..b26f60a 100644 --- a/server/migrations/20260506120000_scope_platform_accounts_to_desktop_client.up.sql +++ b/server/migrations/20260506120000_scope_platform_accounts_to_desktop_client.up.sql @@ -1,3 +1,4 @@ +DROP INDEX IF EXISTS uk_platform_accounts_identity_active; DROP INDEX IF EXISTS uniq_platform_accounts_workspace_identity_active; CREATE UNIQUE INDEX IF NOT EXISTS uniq_platform_accounts_workspace_identity_active