Files
contract-clock-studio-v1/db/migrations/001_app_records.sql

14 lines
537 B
SQL

-- Retained from the full-stack scaffold for fresh installs that expect the
-- starter table. ContractClock product data lives in 001_contract_clock.sql.
CREATE TABLE IF NOT EXISTS app_records (
id BIGSERIAL PRIMARY KEY,
tenant_key TEXT NOT NULL,
record_kind TEXT NOT NULL,
payload JSONB NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE INDEX IF NOT EXISTS app_records_tenant_kind_idx
ON app_records (tenant_key, record_kind, created_at DESC);