Skip to content

Define and migrate BookingAudit table #22831

@linear

Description

@linear

Create a BookingAudit table in the database to record all booking mutations. The table should be optimized for high write throughput and structured as follows:

model BookingAudit {
  id        String   @id @default(uuid7())
  bookingId String
  userId    String?
  type      BookingAuditType
  action    BookingAuditAction?
  timestamp DateTime @default(now())
  data      Json?
}

Notes:

  • No secondary indexes (only primary key).
  • Use uuid7() for time-sortable ID.
  • Strict data typing with Zod

All BookingAudit.data payloads must be strictly validated using Zod schemas before insertion. This prevents schema drift and allows versioned audit payloads.

Requirements:

  • One Zod schema per BookingAuditAction
  • Shared fields: version, actor, internalLog?
  • Provide central map of action → schema

Example:

{
  version: 1,
  type: "rescheduled",
  from: "2025-07-23T10:00Z",
  to: "2025-07-24T10:00Z",
  actor: { type: "attendee" }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enterprisearea: enterprise, audit log, organisation, SAML, SSO❗️ migrationscontains migration files

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions