erDiagram
%% ── Core ──────────────────────────────────────────────
CLUSTERS {
string id PK "slug e.g. production"
string name
string url
string username
string auth_type "basic | trusted | bearer"
datetime created_at
datetime last_used_at
}
%% ── Operational ───────────────────────────────────────
SYNC_LOG {
int id PK
string cluster_id FK
int org_id FK "logical → ts_orgs (composite)"
string entity_type "users|groups|metadata|tags|orgs"
datetime synced_at
int record_count
int duration_ms
string status "SUCCESS|FAILED|IN_PROGRESS"
string error
}
AUDIT_LOG {
int id PK
string cluster_id FK
string action_type "archive|share|delete|tag..."
string entity_type
int items_affected
string parameters "JSON"
string status "SUCCESS|FAILED|PARTIAL"
string error
datetime executed_at
}
JOBS {
string id PK "UUID"
string cluster_id FK
string job_type "archive|share|sync..."
string status "QUEUED|RUNNING|COMPLETE|FAILED|PARTIAL"
int progress
int total
string parameters "JSON"
string result "JSON"
string error
datetime created_at
datetime started_at
datetime completed_at
}
%% ── Cache: cluster-scoped ─────────────────────────────
TS_USERS {
int id PK
string cluster_id FK
string ts_guid "ThoughtSpot GUID"
string username
string display_name
string email
string status "ACTIVE|INACTIVE"
datetime created_at
datetime modified_at
datetime synced_at
}
TS_ORGS {
int id PK
string cluster_id FK
int ts_org_id "ThoughtSpot numeric org ID"
string name
string description
string status "ACTIVE|INACTIVE"
bool is_primary
}
%% ── Cache: org-scoped ────────────────────────────────
TS_GROUPS {
int id PK
string cluster_id FK
int org_id FK "logical → ts_orgs (composite)"
string ts_guid
string name
string display_name
string description
string privileges "JSON list"
datetime created_at
datetime modified_at
datetime synced_at
}
TS_METADATA {
int id PK
string cluster_id FK
int org_id FK "logical → ts_orgs (composite)"
string ts_guid
string name
string object_type "LIVEBOARD|ANSWER|LOGICAL_TABLE..."
string owner_id
string author_name
string tag_ids "JSON list"
datetime created_at
datetime modified_at
datetime last_accessed
int view_count
datetime synced_at
}
TS_TAGS {
int id PK
string cluster_id FK
int org_id FK "logical → ts_orgs (composite)"
string ts_guid
string name
string color
}
%% ── Junction tables ──────────────────────────────────
USER_ORG_MEMBERSHIPS {
int id PK
string cluster_id FK
string ts_guid FK "→ ts_users.ts_guid"
int org_id FK "logical → ts_orgs (composite)"
datetime synced_at
}
USER_GROUP_MEMBERSHIPS {
int id PK
string cluster_id FK
int org_id FK "logical → ts_orgs (composite)"
string user_guid FK "→ ts_users.ts_guid"
string group_guid FK "→ ts_groups.ts_guid"
datetime synced_at
}
CONTENT_PERMISSIONS {
int id PK
string cluster_id FK
int org_id FK "logical → ts_orgs (composite)"
string metadata_guid FK "→ ts_metadata.ts_guid"
string principal_type "user | group"
string principal_guid FK "→ ts_users or ts_groups"
string permission "READ_ONLY | MODIFY"
datetime synced_at
}
%% ── Relationships ────────────────────────────────────
CLUSTERS ||--o{ SYNC_LOG : "tracks sync for"
CLUSTERS ||--o{ AUDIT_LOG : "records actions for"
CLUSTERS ||--o{ JOBS : "runs jobs for"
CLUSTERS ||--o{ TS_USERS : "caches users for"
CLUSTERS ||--o{ TS_ORGS : "caches orgs for"
CLUSTERS ||--o{ TS_GROUPS : "caches groups for"
CLUSTERS ||--o{ TS_METADATA : "caches content for"
CLUSTERS ||--o{ TS_TAGS : "caches tags for"
CLUSTERS ||--o{ USER_ORG_MEMBERSHIPS : "tracks membership for"
CLUSTERS ||--o{ USER_GROUP_MEMBERSHIPS: "tracks membership for"
TS_USERS ||--o{ USER_ORG_MEMBERSHIPS : "belongs to orgs via"
TS_ORGS ||--o{ USER_ORG_MEMBERSHIPS : "has members via"
TS_USERS ||--o{ USER_GROUP_MEMBERSHIPS : "belongs to groups via"
TS_GROUPS ||--o{ USER_GROUP_MEMBERSHIPS : "has members via"
TS_METADATA ||--o{ CONTENT_PERMISSIONS : "shared via"
CLUSTERS ||--o{ CONTENT_PERMISSIONS : "scoped to"
TS_ORGS ||--o{ TS_GROUPS : "contains (logical)"
TS_ORGS ||--o{ TS_METADATA : "contains (logical)"
TS_ORGS ||--o{ TS_TAGS : "contains (logical)"
TS_ORGS ||--o{ USER_ORG_MEMBERSHIPS : "has members via (logical)"
TS_ORGS ||--o{ USER_GROUP_MEMBERSHIPS : "scopes membership (logical)"
TS_ORGS ||--o{ SYNC_LOG : "tracks sync for (logical)"