tia/src/db/schema/audit.ts
Mannu a54f30ddcb Security hardening - all 8 patches applied
Patch 1: Add requireFamily to chat route
Patch 2: Add requireFamily to family routes
Patch 3: Create admin-auth.ts, apply to all admin routes
Patch 4: Delete debug and migrate routes, update middleware
Patch 5: Create audit_log table and schema
Patch 6: Create password reset flow (reset-request, reset-confirm)
Patch 7: Replace with real HTTP security tests
Patch 8: RLS migrations already exist (01-app-role, 02-enable-rls)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 23:59:43 +05:30

13 lines
No EOL
472 B
TypeScript

import { pgTable } from "drizzle-orm/pg-core";
import { text, timestamp, uuid } from "drizzle-orm/pg-core";
export const auditLog = pgTable("audit_log", {
id: uuid("id").defaultRandom().primaryKey(),
userId: uuid("user_id"),
familyId: uuid("family_id"),
action: text("action").notNull(),
metadata: text("metadata"), // JSON string
ipAddress: text("ip_address"),
userAgent: text("user_agent"),
createdAt: timestamp("created_at").defaultNow().notNull(),
});