@xtandard/audit/drizzle/pg
Postgres Drizzle table factories for the audit store: pgAuditTables() (or the
per-table factories) puts the KV and event-log tables in your Drizzle schema
and migrations. Schema-only.
import { … } from "@xtandard/audit/drizzle/pg";Functions
Section titled “Functions”| Name | Summary |
|---|---|
pgAuditEventsTable |
Build the events table: PRIMARY KEY (tenant, seq), UNIQUE (tenant, id) and (tenant, occurred_at, id) / (tenant, actor_id, …) / (tenant, action, …) indexes. The name defaults to "xtandard_audit_events". id, action and occurred_at are text COLLATE "C" (the kit’s textC): bytewise ordering and LIKE prefixes, so (occurred_at, id) sorts exactly like the in-memory matcher whatever the database’s default collation. |
pgAuditEventTargetsTable |
Build the event-targets table (one row per distinct event target), indexed on (tenant, type, target_id, seq) and (tenant, seq). The name defaults to "xtandard_audit_event_targets". |
pgAuditTable |
Build the Drizzle pgTable for the audit KV store. Base columns are fixed — key text PRIMARY KEY, value jsonb NOT NULL — and required by createDrizzleStorage; schema/extraColumns/extraIndexes extend it. The table name defaults to "xtandard_audit". |
pgAuditTables |
All three tables with matching names: {name}, {name}_events, {name}_event_targets (the same layout createPostgresStorage creates). |
Interfaces
Section titled “Interfaces”| Name | Summary |
|---|---|
PgAuditEventTablesOptions |
Options for the event-log table factories. |
PgAuditTableOptions |
Options for pgAuditTable. |
Re-exports
Section titled “Re-exports”| Name | Documented on |
|---|---|
DrizzleAuditTables |
@xtandard/audit/drizzle/mysql |
DrizzleEventsTable |
@xtandard/audit/drizzle/mysql |
DrizzleEventTargetsTable |
@xtandard/audit/drizzle/mysql |