fix(server): scope platform accounts to desktop clients
This commit is contained in:
@@ -48,9 +48,6 @@ CREATE TABLE platform_accounts (
|
|||||||
deleted_at TIMESTAMPTZ
|
deleted_at TIMESTAMPTZ
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE UNIQUE INDEX uk_platform_accounts_identity_active
|
|
||||||
ON platform_accounts(tenant_id, platform_id, platform_uid)
|
|
||||||
WHERE deleted_at IS NULL;
|
|
||||||
CREATE INDEX idx_platform_accounts_tenant_platform ON platform_accounts(tenant_id, platform_id, status, created_at DESC);
|
CREATE INDEX idx_platform_accounts_tenant_platform ON platform_accounts(tenant_id, platform_id, status, created_at DESC);
|
||||||
|
|
||||||
CREATE TABLE publish_batches (
|
CREATE TABLE publish_batches (
|
||||||
|
|||||||
@@ -47,8 +47,6 @@ ALTER TABLE platform_accounts
|
|||||||
ALTER COLUMN health SET NOT NULL,
|
ALTER COLUMN health SET NOT NULL,
|
||||||
ALTER COLUMN sync_version SET NOT NULL;
|
ALTER COLUMN sync_version SET NOT NULL;
|
||||||
|
|
||||||
DROP INDEX IF EXISTS uk_platform_accounts_identity_active;
|
|
||||||
|
|
||||||
CREATE UNIQUE INDEX IF NOT EXISTS uniq_platform_accounts_desktop_id
|
CREATE UNIQUE INDEX IF NOT EXISTS uniq_platform_accounts_desktop_id
|
||||||
ON platform_accounts (desktop_id);
|
ON platform_accounts (desktop_id);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
DROP INDEX IF EXISTS idx_platform_accounts_client_id;
|
||||||
|
DROP INDEX IF EXISTS uniq_platform_accounts_workspace_identity_active;
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX IF NOT EXISTS uk_platform_accounts_identity_active
|
||||||
|
ON platform_accounts (tenant_id, platform_id, platform_uid)
|
||||||
|
WHERE deleted_at IS NULL;
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
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, client_id, platform_id, platform_uid)
|
||||||
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_platform_accounts_client_id
|
||||||
|
ON platform_accounts (client_id)
|
||||||
|
WHERE deleted_at IS NULL;
|
||||||
Reference in New Issue
Block a user