ALTER TABLE "tenant_audit_log" ADD COLUMN "before_state" jsonb;--> statement-breakpoint
ALTER TABLE "tenant_audit_log" ADD COLUMN "after_state" jsonb;--> statement-breakpoint
-- operational-audit-trail: partial index for per-entity history queries (diff-bearing rows only)
CREATE INDEX "idx_tal_entity_history" ON "tenant_audit_log" ("tenant_id", "entity_type", "entity_id", "created_at" DESC) WHERE before_state IS NOT NULL OR after_state IS NOT NULL;