Skip to content

Data Model

Last updated: 2026-05-19

Full schema lives in finstack-rs/migrations/. Below are tables added or modified during active development; historical tables are in earlier migrations (0001–0027).

Tracks tenants that have provisioned a managed Postgres database via Post AI.

ColumnTypeNotes
idUUID PKgen_random_uuid()
tenant_idUUID NOT NULLFK → tenants(id) ON DELETE CASCADE; UNIQUE
post_ai_tenant_idTEXT NOT NULLString representation of tenant_id UUID used as x-tenant-id with Post AI
provisioned_atTIMESTAMPTZ NOT NULLnow() default
statusTEXT NOT NULL'active' default

Constraints: UNIQUE (tenant_id)ON CONFLICT DO NOTHING makes record_provision idempotent.

RLS: ENABLE ROW LEVEL SECURITY + FORCE ROW LEVEL SECURITY. Policy: tenant_id = current_setting('app.tenant_id', true)::uuid.

Index: database_provisions_tenant_id_idx on (tenant_id).