Skip to content

Prisma Schema Reference

Prisma Schema Reference

Auto-documented from prisma/schema.prisma — All 20 models with their fields, types, relations, constraints, and indexes. Grouped by domain.


Table of Contents


Schema Overview

DomainModelsPurpose
AuthUser, Session, Account, Verification, ApiKey, TwoFactorIdentity, sessions, OAuth accounts, email verification, API keys, 2FA
ContentFilterSource, FilterListVersion, CompiledOutput, CompilationEventFilter lists, versions, compiled outputs, telemetry
Health MonitoringSourceHealthSnapshot, SourceChangeEventSource reliability tracking, change detection
Agent SessionsAgentSession, AgentInvocation, AgentAuditLogCloudflare Agents session tracking, tool invocations, security audit
DeploymentDeploymentHistory, DeploymentCounterWorker deployment tracking (migrated from D1)
LegacyStorageEntry, FilterCache, CompilationMetadataBackward-compatible storage (migration target)

Model Ownership

ModelUsed By
User, Session, Account, VerificationBetter Auth (via prismaAdapter)
TwoFactorBetter Auth (twoFactor plugin)
User (Clerk fields: clerkUserId, firstName, lastName)Clerk webhooks (deprecated)
ApiKeyAuth middleware (authenticateApiKey())
FilterSource, FilterListVersionCompilation pipeline + source health monitor
CompiledOutput, CompilationEventCompilation pipeline + telemetry
AgentSession, AgentInvocationCloudflare Agents (WebSocket/SSE session tracking)
AgentAuditLogAgent security audit (append-only)
DeploymentHistory, DeploymentCounterCI/CD deployment pipeline
StorageEntry, FilterCache, CompilationMetadataHyperdriveStorageAdapter + D1StorageAdapter (legacy)

Entity Relationship Diagram

erDiagram
    User ||--o{ Session : "has many"
    User ||--o{ Account : "has many"
    User ||--o{ ApiKey : "has many"
    User ||--o| TwoFactor : "has one"
    User o|--o{ AgentSession : "has many (optional user)"

    FilterSource ||--o{ FilterListVersion : "has many"
    FilterSource ||--o{ SourceHealthSnapshot : "has many"
    FilterSource ||--o{ SourceChangeEvent : "has many"

    CompiledOutput ||--o{ CompilationEvent : "has many"

    AgentSession ||--o{ AgentInvocation : "has many"

    User {
        uuid id PK
        string email UK
        string displayName
        string role
        string clerkUserId UK
        string tier
        string firstName
        string lastName
        string imageUrl
        boolean emailVerified
        boolean twoFactorEnabled
        boolean banned
        string banReason
        timestamptz banExpires
        timestamptz lastSignInAt
        timestamptz createdAt
        timestamptz updatedAt
    }

    Session {
        uuid id PK
        uuid userId FK
        string token UK
        string tokenHash UK
        string ipAddress
        string userAgent
        timestamptz expiresAt
        timestamptz createdAt
        timestamptz updatedAt
    }

    Account {
        uuid id PK
        uuid userId FK
        string accountId
        string providerId
        string accessToken
        string refreshToken
        timestamptz accessTokenExpiresAt
        timestamptz refreshTokenExpiresAt
        string scope
        string idToken
        string password
        timestamptz createdAt
        timestamptz updatedAt
    }

    Verification {
        uuid id PK
        string identifier
        string value
        timestamptz expiresAt
        timestamptz createdAt
        timestamptz updatedAt
    }

    ApiKey {
        uuid id PK
        uuid userId FK
        string keyHash UK
        string keyPrefix
        string name
        string[] scopes
        int rateLimitPerMinute
        timestamptz expiresAt
        timestamptz revokedAt
        timestamptz lastUsedAt
        timestamptz createdAt
        timestamptz updatedAt
    }

    TwoFactor {
        uuid id PK
        uuid userId FK
        string secret
        string backupCodes
    }

    FilterSource {
        uuid id PK
        string url UK
        string name
        string status
        int refreshIntervalSeconds
        int consecutiveFailures
        timestamptz lastCheckedAt
        timestamptz createdAt
        timestamptz updatedAt
    }

    FilterListVersion {
        uuid id PK
        uuid sourceId FK
        string contentHash
        int ruleCount
        string r2Key
        boolean isCurrent
        timestamptz fetchedAt
        timestamptz expiresAt
    }

    CompiledOutput {
        uuid id PK
        string configHash UK
        string configName
        jsonb configSnapshot
        int ruleCount
        string r2Key
        timestamptz createdAt
        timestamptz expiresAt
    }

    CompilationEvent {
        uuid id PK
        uuid compiledOutputId FK
        uuid userId FK
        string requestSource
        int durationMs
        boolean cacheHit
        timestamptz createdAt
    }

    SourceHealthSnapshot {
        uuid id PK
        uuid sourceId FK
        string status
        int totalAttempts
        int successfulAttempts
        float avgDurationMs
        timestamptz recordedAt
    }

    SourceChangeEvent {
        uuid id PK
        uuid sourceId FK
        uuid previousVersionId
        uuid newVersionId
        int ruleCountDelta
        boolean contentHashChanged
        timestamptz detectedAt
    }

    AgentSession {
        uuid id PK
        string agentSlug
        string instanceId
        uuid userId FK
        string clerkUserId
        timestamptz startedAt
        timestamptz endedAt
        string endReason
        int messageCount
        string transport
        string clientIp
        string userAgent
        json metadata
    }

    AgentInvocation {
        uuid id PK
        uuid sessionId FK
        string toolName
        string inputSummary
        string outputSummary
        int durationMs
        boolean success
        string errorMessage
        timestamptz invokedAt
        jsonb metadata
    }

    AgentAuditLog {
        uuid id PK
        uuid actorUserId
        string agentSlug
        string instanceId
        string action
        string status
        string ipAddress
        string userAgent
        string reason
        jsonb metadata
        timestamptz createdAt
    }

    DeploymentHistory {
        string id PK
        string version
        int buildNumber
        string fullVersion UK
        string gitCommit
        string gitBranch
        timestamptz deployedAt
        string deployedBy
        string status
        int deploymentDuration
        string workflowRunId
        string workflowRunUrl
        jsonb metadata
    }

    DeploymentCounter {
        string version PK
        int lastBuildNumber
        timestamptz updatedAt
    }

    StorageEntry {
        cuid id PK
        string key UK
        string data
        datetime createdAt
        datetime expiresAt
    }

    FilterCache {
        cuid id PK
        string source UK
        string content
        string hash
        datetime expiresAt
    }

    CompilationMetadata {
        cuid id PK
        string configName
        datetime timestamp
        int ruleCount
        int duration
    }

Auth Domain

User

The central identity model. Used by Better Auth for session-based authentication and by Clerk webhooks for user sync (deprecated).

FieldTypeAttributesDescription
idString (UUID)@id @default(uuid())Primary key
emailString?@uniqueLogin email (nullable for anonymous users)
displayNameString?@map("display_name")User display name
roleString@default("user")admin | user | readonly
createdAtDateTime@default(now()) @db.TimestamptzCreation timestamp
updatedAtDateTime@updatedAt @db.TimestamptzLast update
clerkUserIdString?@unique @map("clerk_user_id")Clerk integration (deprecated)
tierString@default("free")anonymous | free | pro | admin
firstNameString?@map("first_name")From Clerk (deprecated)
lastNameString?@map("last_name")From Clerk (deprecated)
imageUrlString?@map("image_url")Avatar URL
emailVerifiedBoolean@default(false)Email verification status
lastSignInAtDateTime?@db.TimestamptzLast sign-in timestamp
twoFactorEnabledBoolean@default(false) @map("two_factor_enabled")Whether 2FA is enabled (Better Auth)
bannedBoolean@default(false)Whether the user is banned (Better Auth)
banReasonString?@map("ban_reason")Reason for ban
banExpiresDateTime?@db.Timestamptz @map("ban_expires")Ban expiry (null = permanent)

Table name: users Relations: apiKeys → ApiKey[], sessions → Session[], accounts → Account[], twoFactor → TwoFactor?, agentSessions → AgentSession[] Unique constraints: email, clerkUserId

Note: The Clerk-specific fields (clerkUserId, firstName, lastName, imageUrl, lastSignInAt) will be removed after the Clerk → Better Auth migration completes. Better Auth uses displayName and reads tier/role directly from the database.


Session

Tracks active user sessions. Created by Better Auth on sign-in.

FieldTypeAttributesDescription
idString (UUID)@id @default(uuid())Primary key
userIdString (UUID)@map("user_id")FK → User
tokenString@uniqueBetter Auth session token
tokenHashString?@unique @map("token_hash")Legacy Clerk token hash (nullable)
ipAddressString?@map("ip_address")Client IP
userAgentString?@map("user_agent")Client user agent
expiresAtDateTime@db.TimestamptzSession expiry
createdAtDateTime@default(now()) @db.TimestamptzCreation timestamp
updatedAtDateTime@updatedAt @db.TimestamptzLast update

Table name: sessions Relations: user → User (via userId, cascade delete) Indexes: userId Unique constraints: token, tokenHash

Note: tokenHash is nullable — Better Auth sessions use token directly. The tokenHash column exists for backward compatibility with Clerk sessions and will be removed after migration.


Account

OAuth / credential accounts linked to a user. Managed by Better Auth.

FieldTypeAttributesDescription
idString (UUID)@id @default(uuid())Primary key
userIdString (UUID)@map("user_id")FK → User
accountIdString@map("account_id")Provider-specific account ID
providerIdString@map("provider_id")Provider name (e.g., credential, google)
accessTokenString?@map("access_token")OAuth access token
refreshTokenString?@map("refresh_token")OAuth refresh token
accessTokenExpiresAtDateTime?@db.TimestamptzAccess token expiry
refreshTokenExpiresAtDateTime?@db.TimestamptzRefresh token expiry
scopeString?OAuth scopes
idTokenString?@map("id_token")OIDC ID token
passwordString?Hashed password (for credential provider)
createdAtDateTime@default(now()) @db.TimestamptzCreation timestamp
updatedAtDateTime@updatedAt @db.TimestamptzLast update

Table name: account Relations: user → User (via userId, cascade delete)


Verification

Email verification and password reset tokens. Managed by Better Auth.

FieldTypeAttributesDescription
idString (UUID)@id @default(uuid())Primary key
identifierStringWhat’s being verified (e.g., email)
valueStringVerification token value
expiresAtDateTime@db.TimestamptzToken expiry
createdAtDateTime@default(now()) @db.TimestamptzCreation timestamp
updatedAtDateTime@updatedAt @db.TimestamptzLast update

Table name: verification


ApiKey

API keys for programmatic access. Managed by the auth middleware — not by Better Auth.

FieldTypeAttributesDescription
idString (UUID)@id @default(uuid())Primary key
userIdString (UUID)@map("user_id")FK → User (owner)
keyHashString@unique @map("key_hash")SHA-256 hash of the full API key
keyPrefixString@map("key_prefix")First 8 chars for display (e.g., abc_sk_l)
nameStringHuman-readable key name
scopesString[]@default(["compile"])Permission scopes
rateLimitPerMinuteInt@default(60)Per-key rate limit
lastUsedAtDateTime?@db.TimestamptzLast usage timestamp (fire-and-forget update)
expiresAtDateTime?@db.TimestamptzExpiry (null = never)
revokedAtDateTime?@db.TimestamptzRevocation timestamp (null = active)
createdAtDateTime@default(now()) @db.TimestamptzCreation timestamp
updatedAtDateTime@updatedAt @db.TimestamptzLast update

Table name: api_keys Relations: user → User (via userId, cascade delete) Indexes: userId Unique constraints: keyHash


TwoFactor

Stores TOTP secrets and backup codes per user. Managed by the Better Auth twoFactor plugin.

FieldTypeAttributesDescription
idString (UUID)@id @default(uuid())Primary key
userIdString (UUID)@map("user_id")FK → User (unique — one record per user)
secretStringEncrypted TOTP secret
backupCodesString@map("backup_codes")JSON-encoded backup code array

Table name: two_factor Relations: user → User (via userId, cascade delete) Unique constraints: userId


Content Domain

FilterSource

Represents a remote filter list URL (e.g., EasyList). The system periodically fetches these sources and stores versioned snapshots.

FieldTypeAttributesDescription
idString (UUID)@id @default(uuid())Primary key
urlString@uniqueFilter list URL
nameStringHuman-readable name
descriptionString?Optional description
homepageString?Source homepage URL
licenseString?License identifier
isPublicBoolean@default(true)Publicly visible?
ownerUserIdString? (UUID)Owner (for private sources)
refreshIntervalSecondsInt@default(3600)How often to re-fetch (seconds)
lastCheckedAtDateTime?@db.TimestamptzLast fetch attempt
lastSuccessAtDateTime?@db.TimestamptzLast successful fetch
lastFailureAtDateTime?@db.TimestamptzLast failed fetch
consecutiveFailuresInt@default(0)Failure streak counter
statusString@default("unknown")healthy | degraded | unhealthy | unknown
createdAtDateTime@default(now()) @db.TimestamptzCreation timestamp
updatedAtDateTime@updatedAt @db.TimestamptzLast update

Table name: filter_sources Relations: versions → FilterListVersion[], healthSnapshots → SourceHealthSnapshot[], changeEvents → SourceChangeEvent[] Indexes: status Unique constraints: url


FilterListVersion

A point-in-time snapshot of a filter source’s content. The actual content is stored in R2 (referenced by r2Key); the database stores metadata and the content hash.

FieldTypeAttributesDescription
idString (UUID)@id @default(uuid())Primary key
sourceIdString (UUID)@map("source_id")FK → FilterSource
contentHashString@map("content_hash")SHA-256 of content
ruleCountInt@map("rule_count")Number of rules in this version
etagString?HTTP ETag from source server
r2KeyString@map("r2_key")Pointer to R2 object
fetchedAtDateTime@default(now()) @db.TimestamptzWhen fetched
expiresAtDateTime?@db.TimestamptzCache expiry
isCurrentBoolean@default(false)Is this the active version?

Table name: filter_list_versions Relations: source → FilterSource (via sourceId, cascade delete) Indexes: (sourceId, isCurrent), contentHash

Note: A partial unique index should be applied via SQL migration to enforce “at most one current version per source”:

CREATE UNIQUE INDEX idx_filter_list_versions_current
ON filter_list_versions(source_id) WHERE is_current = true;

CompiledOutput

A compiled filter list output. Contains the compilation configuration snapshot and points to the compiled content in R2.

FieldTypeAttributesDescription
idString (UUID)@id @default(uuid())Primary key
configHashString@unique @map("config_hash")Hash of the compilation config
configNameString@map("config_name")Human-readable config name
configSnapshotJson@db.JsonBFull config at compilation time
ruleCountInt@map("rule_count")Total rules in output
sourceCountInt@map("source_count")Number of sources used
durationMsInt@map("duration_ms")Compilation duration
r2KeyString@map("r2_key")Pointer to R2 object
ownerUserIdString? (UUID)@map("owner_user_id")Who triggered it
createdAtDateTime@default(now()) @db.TimestamptzCreation timestamp
expiresAtDateTime?@db.TimestamptzCache expiry

Table name: compiled_outputs Relations: events → CompilationEvent[] Indexes: configName, createdAt DESC, ownerUserId Unique constraints: configHash


CompilationEvent

Append-only telemetry for compilation requests. Used for analytics, billing, and debugging.

FieldTypeAttributesDescription
idString (UUID)@id @default(uuid())Primary key
compiledOutputIdString? (UUID)@map("compiled_output_id")FK → CompiledOutput (nullable for failed compilations)
userIdString? (UUID)@map("user_id")Who triggered it
apiKeyIdString? (UUID)@map("api_key_id")Which API key was used
requestSourceString@map("request_source")worker | cli | batch_api | workflow
workerRegionString?@map("worker_region")Cloudflare colo
durationMsInt@map("duration_ms")Request duration
cacheHitBoolean@default(false)Was a cached output served?
errorMessageString?@map("error_message")Error (for failed compilations)
createdAtDateTime@default(now()) @db.TimestamptzEvent timestamp

Table name: compilation_events Relations: compiledOutput → CompiledOutput? (via compiledOutputId, set null on delete) Indexes: createdAt DESC, userId


Health Monitoring Domain

SourceHealthSnapshot

Periodic health snapshots for filter sources. Used by the source health dashboard.

FieldTypeAttributesDescription
idString (UUID)@id @default(uuid())Primary key
sourceIdString (UUID)@map("source_id")FK → FilterSource
statusStringhealthy | degraded | unhealthy
totalAttemptsInt@default(0)Total fetch attempts in period
successfulAttemptsInt@default(0)Successful fetches
failedAttemptsInt@default(0)Failed fetches
consecutiveFailuresInt@default(0)Current failure streak
avgDurationMsFloat@default(0)Average fetch duration
avgRuleCountFloat@default(0)Average rules per fetch
recordedAtDateTime@default(now()) @db.TimestamptzSnapshot timestamp

Table name: source_health_snapshots Relations: source → FilterSource (via sourceId, cascade delete) Indexes: sourceId, recordedAt DESC


SourceChangeEvent

Records when a filter source’s content changes between versions.

FieldTypeAttributesDescription
idString (UUID)@id @default(uuid())Primary key
sourceIdString (UUID)@map("source_id")FK → FilterSource
previousVersionIdString? (UUID)@map("previous_version_id")Previous version ID
newVersionIdString (UUID)@map("new_version_id")New version ID
ruleCountDeltaInt@default(0)Change in rule count
contentHashChangedBoolean@default(true)Whether content actually changed
detectedAtDateTime@default(now()) @db.TimestamptzDetection timestamp

Table name: source_change_events Relations: source → FilterSource (via sourceId, cascade delete) Indexes: sourceId, detectedAt DESC


Agent Sessions Domain

AgentSession

Tracks active and historical Cloudflare Agents connections over WebSocket or SSE.

FieldTypeAttributesDescription
idString (UUID)@id @default(uuid())Primary key
agentSlugString@map("agent_slug")Agent identifier from AGENT_REGISTRY
instanceIdString@map("instance_id")Durable Object instance name
userIdString? (UUID)@map("user_id")FK → User (nullable for anonymous)
clerkUserIdString?@map("clerk_user_id")Clerk user ID (legacy / cross-reference)
startedAtDateTime@default(now()) @db.TimestamptzSession start time
endedAtDateTime?@db.TimestamptzSession end time (NULL = still active)
endReasonString?@map("end_reason")client_disconnect | server_error | admin_terminate | timeout
messageCountInt@default(0)WebSocket messages received
transportString@default("websocket")websocket | sse
clientIpString?@map("client_ip")Client IP address
userAgentString?@map("user_agent")Client user agent
metadataJson?Extensibility JSON blob

Table name: agent_sessions Relations: user → User? (via userId, set null on delete), invocations → AgentInvocation[] Indexes: userId, clerkUserId, agentSlug, startedAt, (userId, endedAt) (active sessions per user)


AgentInvocation

Tracks individual tool calls / actions within an agent session.

FieldTypeAttributesDescription
idString (UUID)@id @default(uuid())Primary key
sessionIdString (UUID)@map("session_id")FK → AgentSession
toolNameString@map("tool_name")Name of the tool called
inputSummaryString?@map("input_summary")Brief summary of tool input
outputSummaryString?@map("output_summary")Brief summary of tool output
durationMsInt?@map("duration_ms")Invocation duration
successBoolean@default(true)Whether the invocation succeeded
errorMessageString?@map("error_message")Error message if failed
invokedAtDateTime@default(now()) @db.TimestamptzInvocation timestamp
metadataJson?@db.JsonBExtensibility JSON blob

Table name: agent_invocations Relations: session → AgentSession (via sessionId, cascade delete) Indexes: sessionId, toolName, invokedAt


AgentAuditLog

Append-only audit log for agent-related security events (ZTA telemetry).

FieldTypeAttributesDescription
idString (UUID)@id @default(uuid())Primary key
actorUserIdString? (UUID)@map("actor_user_id")User who triggered the action
agentSlugString?@map("agent_slug")Agent identifier
instanceIdString?@map("instance_id")Durable Object instance
actionStringAction type (e.g., session_start, tool_invoke)
statusString@default("success")success | failure
ipAddressString?@map("ip_address")Client IP
userAgentString?@map("user_agent")Client user agent
reasonString?Reason for the action / failure
metadataJson?@db.JsonBExtensibility JSON blob
createdAtDateTime@default(now()) @db.TimestamptzEvent timestamp

Table name: agent_audit_logs Indexes: actorUserId, agentSlug, action, createdAt

Append-only: Never update or delete rows from this table. It feeds ZTA security dashboards and SIEM pipelines via AnalyticsService.trackSecurityEvent().


Deployment Domain

DeploymentHistory

Tracks worker deployments. Migrated from the legacy D1 deployment_history table.

FieldTypeAttributesDescription
idString@idPrimary key (string, not UUID)
versionStringSemantic version string
buildNumberInt@map("build_number")Monotonically increasing build number
fullVersionString@unique @map("full_version")e.g., 1.2.3-45
gitCommitString@map("git_commit")Git commit SHA
gitBranchString@map("git_branch")Git branch name
deployedAtDateTime@default(now()) @db.TimestamptzDeployment timestamp
deployedByString@map("deployed_by")Actor (e.g., GitHub Actions bot)
statusString@default("success")success | failure | rollback
deploymentDurationInt?@map("deployment_duration")Duration in seconds
workflowRunIdString?@map("workflow_run_id")GitHub Actions run ID
workflowRunUrlString?@map("workflow_run_url")GitHub Actions run URL
metadataJson?@db.JsonBAdditional deployment metadata

Table name: deployment_history Unique constraints: fullVersion, (version, buildNumber) Indexes: version, buildNumber, deployedAt DESC, status, gitCommit


DeploymentCounter

Tracks the last build number per version to support monotonically incrementing builds.

FieldTypeAttributesDescription
versionString@idVersion string (primary key)
lastBuildNumberInt@default(0) @map("last_build_number")Last issued build number for this version
updatedAtDateTime@updatedAt @db.TimestamptzLast update

Table name: deployment_counter


Legacy / Compatibility Domain

⚠️ These models are retained for backward compatibility with the HyperdriveStorageAdapter and D1StorageAdapter. New code should use the Content domain models (CompiledOutput, CompilationEvent, etc.) instead.

StorageEntry

Generic key-value storage. Used by IStorageAdapter.set() / .get().

FieldTypeAttributesDescription
idString@id @default(cuid())Primary key (CUID)
keyString@uniqueStorage key
dataStringSerialized JSON value
createdAtDateTime@default(now())Creation timestamp
updatedAtDateTime@updatedAtLast update
expiresAtDateTime?TTL expiry
tagsString?Optional tags

Table name: storage_entries Indexes: key, expiresAt ID strategy: cuid() (not UUID — legacy)


FilterCache

Cached filter list content. Used by IStorageAdapter.cacheFilterList().

FieldTypeAttributesDescription
idString@id @default(cuid())Primary key (CUID)
sourceString@uniqueSource URL
contentStringCached content
hashStringContent hash
etagString?HTTP ETag
createdAtDateTime@default(now())Creation timestamp
updatedAtDateTime@updatedAtLast update
expiresAtDateTime?TTL expiry

Table name: filter_cache Indexes: source, expiresAt ID strategy: cuid() (not UUID — legacy)


CompilationMetadata

Legacy compilation metadata. Used by IStorageAdapter.storeCompilationMetadata().

FieldTypeAttributesDescription
idString@id @default(cuid())Primary key (CUID)
configNameStringConfiguration name
timestampDateTime@default(now())Compilation time
sourceCountIntNumber of sources
ruleCountIntTotal rules
durationIntDuration in ms
outputPathString?Output file path

Table name: compilation_metadata Indexes: configName, timestamp ID strategy: cuid() (not UUID — legacy)

TODO (Phase 2): Migrate callers to use CompiledOutput + CompilationEvent instead. See the comment in prisma/schema.prisma.


Generator & Datasource Configuration

generator client {
provider = "prisma-client"
output = "./generated"
runtime = "cloudflare"
// "cloudflare" runtime uses @prisma/adapter-pg code path — no runtime WASM.
// Required for Cloudflare Workers which block WebAssembly.Module() at runtime.
}
datasource db {
provider = "postgresql"
// Connection URL is configured in prisma.config.ts (Prisma 7+)
}
SettingValueNotes
Generatorprisma-clientGenerates to prisma/generated/
ProviderpostgresqlNeon PostgreSQL
URL resolutionprisma.config.tsDIRECT_DATABASE_URLDATABASE_URL fallback
Post-generate scriptscripts/prisma-fix-imports.tsFixes imports for Deno compatibility

⚠️ Always use deno task db:generate instead of npx prisma generate to ensure the import fixer runs.


Naming Conventions

Prisma ConventionPostgreSQL ConventionExample
Model name: PascalCaseTable name: snake_case via @@mapFilterSourcefilter_sources
Field name: camelCaseColumn name: snake_case via @mapuserIduser_id
ID fields: UUID@db.Uuid@id @default(uuid()) @db.Uuid
Timestamps: Timestamptz@db.Timestamptz@default(now()) @db.Timestamptz
Legacy IDs: CUID@default(cuid())StorageEntry, FilterCache, CompilationMetadata

PostgreSQL-Specific Types

Prisma TypePostgreSQL TypeUsed In
String @db.UuiduuidAll auth + content domain IDs
DateTime @db.TimestamptztimestamptzAll timestamps (timezone-aware)
Json @db.JsonBjsonbCompiledOutput.configSnapshot
String[]text[]ApiKey.scopes

Further Reading