perf(struct): ddd

This commit is contained in:
2026-02-03 17:31:08 +08:00
parent 202b5eaad5
commit 4a071bd7c8
64 changed files with 1214 additions and 1189 deletions

View File

@@ -0,0 +1,14 @@
BEGIN;
CREATE TABLE IF NOT EXISTS tenant_oauth_clients (
tenant_id UUID NOT NULL REFERENCES tenants(id) ON DELETE CASCADE,
client_id VARCHAR(64) NOT NULL REFERENCES oauth_clients(client_id) ON DELETE CASCADE,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
PRIMARY KEY (tenant_id, client_id)
);
CREATE INDEX IF NOT EXISTS idx_tenant_oauth_clients_tenant_id ON tenant_oauth_clients(tenant_id);
CREATE INDEX IF NOT EXISTS idx_tenant_oauth_clients_client_id ON tenant_oauth_clients(client_id);
COMMIT;

View File

@@ -0,0 +1,10 @@
BEGIN;
INSERT INTO tenant_oauth_clients (tenant_id, client_id)
SELECT t.id, c.client_id
FROM tenants t
CROSS JOIN oauth_clients c
ON CONFLICT (tenant_id, client_id) DO NOTHING;
COMMIT;