Schema Reference
Database schema reference generated from Prisma schema
Schema Reference
Auto-generated from prisma/schema.prisma. This page documents the database models and enums used by the NorthRelay API.
Last generated: 2026-03-19
Models
| Model | Table | Fields | Description |
|---|---|---|---|
| Account | accounts | 12 | |
| Session | sessions | 4 | |
| VerificationToken | verification_tokens | 3 | |
| User | users | 66 | |
| InboxSettings | inbox_settings | 13 | |
| ApiKey | api_keys | 16 | |
| AuditLog | audit_logs | 9 | |
| AdminAuditLog | admin_audit_logs | 6 | |
| Domain | domains | 25 | |
| SystemDomain | system_domains | 8 | |
| SubdomainSlot | subdomain_slots | 8 | |
| Mailbox | mailboxes | 10 | |
| MailboxAlias | mailbox_aliases | 7 | |
| InboxUser | inbox_users | 21 | |
| InboxUserAlias | inbox_user_aliases | 6 | |
emails | 26 | ||
| EmailEvent | email_events | 16 | |
| ScheduledEmail | scheduled_emails | 9 | |
| Suppression | suppressions | 6 | |
| Template | templates | 20 | |
| TemplateVersion | template_versions | 11 | |
| BrandTheme | brand_themes | 32 | |
| UnsubscribePreference | unsubscribe_preferences | 5 | |
| Webhook | webhooks | 17 | |
| WebhookDelivery | webhook_deliveries | 9 | |
| AbuseReport | abuse_reports | 16 | |
| AdminNote | admin_notes | 6 | |
| ReputationScore | reputation_scores | 16 | |
| ReputationHistory | reputation_history | 9 | |
| ReputationIncident | reputation_incidents | 10 | |
| SystemAlert | system_alerts | 13 | |
| SystemConfig | system_config | 5 | |
| MaintenanceWindow | maintenance_windows | 10 | |
| BackupLog | backup_logs | 11 | |
| AlertConfiguration | alert_configurations | 11 | |
| Invoice | invoices | 10 | |
| EmailBatch | email_batches | 11 | |
| SuppressionGroup | suppression_groups | 8 | |
| SuppressionGroupMember | suppression_group_members | 4 | |
| DedicatedIp | dedicated_ips | 9 | |
| IpPool | ip_pools | 7 | |
| IpPoolIp | ip_pool_ips | 3 | |
| Subuser | subusers | 11 | |
| RevokedToken | revoked_tokens | 5 | |
| Contact | contacts | 18 | |
| ContactTag | contact_tags | 3 | |
| ContactCustomField | contact_custom_fields | 4 | |
| Campaign | campaigns | 41 | |
| ContactList | contact_lists | 16 | |
| ContactListMember | contact_list_members | 7 | |
| CampaignRecipient | campaign_recipients | 11 | |
| CampaignEvent | campaign_events | 8 | |
| DomainAddon | domain_addons | 12 | |
| PendingSignup | pending_signups | 10 | |
| SystemSetting | system_settings | 8 |
Account
Table: accounts
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
type | String | Yes | - | |
provider | String | Yes | - | |
refreshToken | String | No | - | Column: refresh_token |
accessToken | String | No | - | Column: access_token |
expiresAt | Int | No | - | Column: expires_at |
tokenType | String | No | - | Column: token_type |
scope | String | No | - | |
idToken | String | No | - | Column: id_token |
sessionState | String | No | - | Column: session_state |
providerAccountId | String | Yes | - | Column: provider_account_id |
userId | String | Yes | - | Column: user_id |
Unique constraints: (provider, providerAccountId)
Session
Table: sessions
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
expires | DateTime | Yes | - | |
sessionToken | String | Yes | - | Unique, Column: session_token |
userId | String | Yes | - |
VerificationToken
Table: verification_tokens
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
identifier | String | Yes | - | |
token | String | Yes | - | Unique |
expires | DateTime | Yes | - |
Unique constraints: (identifier, token)
User
Table: users
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
name | String | No | - | |
email | String | Yes | - | Unique |
emailVerified | DateTime | No | - | |
passwordHash | String | No | - | |
image | String | No | - | |
createdAt | DateTime | Yes | now( | |
updatedAt | DateTime | Yes | - | |
quotaLimit | Int | Yes | 3000 | |
quotaUsed | Int | Yes | 0 | |
quotaResetAt | DateTime | Yes | now( | |
poolType | PoolType | Yes | Shared | |
planTier | PlanTier | Yes | Free | |
role | user_role | Yes | USER | |
accountType | account_type | Yes | USER | Column: account_type |
status | user_status | Yes | ACTIVE | |
suspendReason | String | No | - | |
suspendedAt | DateTime | No | - | Column: suspended_at |
verificationCode | String | No | - | Column: verification_code |
verificationCodeExpires | DateTime | No | - | Column: verification_code_expires |
verificationToken | String | No | - | Column: verification_token |
company | String | No | - | |
stripeCustomerId | String | No | - | Column: stripe_customer_id |
stripeSubscriptionId | String | No | - | Column: stripe_subscription_id |
stripePaymentMethodId | String | No | - | Column: stripe_payment_method_id |
timezone | String | Yes | "UTC" | |
totpSecret | String | No | - | Column: totp_secret |
totpEnabled | Boolean | Yes | false | Column: totp_enabled |
totpBackupCodes | String[] | Yes | - | Column: totp_backup_codes |
totpVerifiedAt | DateTime | No | - | Column: totp_verified_at |
notifyDeliveryReports | Boolean | Yes | true | Column: notify_delivery_reports |
notifyBounceAlerts | Boolean | Yes | true | Column: notify_bounce_alerts |
notifyBillingUpdates | Boolean | Yes | true | Column: notify_billing_updates |
notifyProductUpdates | Boolean | Yes | false | Column: notify_product_updates |
templateDefaults | Json | No | - | Column: template_defaults |
deletedAt | DateTime | No | - | Column: deleted_at |
abuseReports | AbuseReport[] | Yes | - | |
accounts | Account[] | Yes | - | |
apiKeys | ApiKey[] | Yes | - | |
auditLogs | AuditLog[] | Yes | - | |
domains | Domain[] | Yes | - | |
emailEvents | EmailEvent[] | Yes | - | |
emails | Email[] | Yes | - | |
emailBatches | EmailBatch[] | Yes | - | |
invoices | Invoice[] | Yes | - | |
mailboxes | Mailbox[] | Yes | - | |
mailboxAliases | MailboxAlias[] | Yes | - | |
reputationScore | ReputationScore | No | - | |
scheduledEmails | ScheduledEmail[] | Yes | - | |
sessions | Session[] | Yes | - | |
suppressions | Suppression[] | Yes | - | |
templates | Template[] | Yes | - | |
webhooks | Webhook[] | Yes | - | |
inboxSettings | InboxSettings | No | - | |
suppressionGroups | SuppressionGroup[] | Yes | - | |
dedicatedIps | DedicatedIp[] | Yes | - | |
ipPools | IpPool[] | Yes | - | |
subusers | Subuser[] | Yes | - | |
revokedTokens | RevokedToken[] | Yes | - | |
brandThemes | BrandTheme[] | Yes | - | |
unsubscribePreferences | UnsubscribePreference[] | Yes | - | |
contacts | Contact[] | Yes | - | |
inboxUsers | InboxUser[] | Yes | - | |
campaigns | Campaign[] | Yes | - | |
contactLists | ContactList[] | Yes | - | |
domainAddons | DomainAddon[] | Yes | - |
InboxSettings
Table: inbox_settings
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
userId | String | Yes | - | Unique, Column: user_id |
signature | String | No | - | |
showImages | Boolean | Yes | true | Column: show_images |
autoArchive | Boolean | Yes | false | Column: auto_archive |
replyFormat | String | Yes | "inline" | |
previewLines | Int | Yes | 2 | Column: preview_lines |
notifications | Json | No | - | |
security | Json | No | - | |
appearance | Json | No | - | |
filters | Json | No | - | |
createdAt | DateTime | Yes | now( | Column: created_at |
updatedAt | DateTime | Yes | - | Column: updated_at |
ApiKey
Table: api_keys
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
name | String | Yes | - | |
active | Boolean | Yes | true | |
isRevoked | Boolean | Yes | false | Column: is_revoked |
revokedAt | DateTime | No | - | Column: revoked_at |
revokedBy | String | No | - | Column: revoked_by |
banReason | String | No | - | Column: ban_reason |
createdAt | DateTime | Yes | now( | Column: created_at |
expiresAt | DateTime | No | - | Column: expires_at |
keyHash | String | Yes | - | Unique, Column: key_hash |
keyPrefix | String | Yes | - | Column: key_prefix |
bcryptHash | String | No | - | Column: bcrypt_hash |
lastUsedAt | DateTime | No | - | Column: last_used_at |
usageCount | Int | Yes | 0 | Column: usage_count |
scopes | Json | No | - | |
userId | String | Yes | - | Column: user_id |
AuditLog
Table: audit_logs
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
action | String | Yes | - | |
location | String | No | - | |
status | String | Yes | - | |
metadata | Json | No | - | |
timestamp | DateTime | Yes | now( | |
ipAddress | String | No | "unknown" | Column: ip_address |
userAgent | String | No | - | Column: user_agent |
userId | String | No | - | Column: user_id |
AdminAuditLog
Table: admin_audit_logs
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
adminEmail | String | Yes | - | |
action | String | Yes | - | |
targetUserId | String | No | - | |
details | Json | No | - | |
createdAt | DateTime | Yes | now( |
Domain
Table: domains
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
userId | String | Yes | - | |
hostname | String | Yes | - | |
domainType | DomainType | Yes | CUSTOM | |
verified | Boolean | Yes | false | |
isSystemDomain | Boolean | Yes | false | Column: is_system_domain |
isManagedDomain | Boolean | Yes | false | |
parentDomain | String | No | - | |
subdomain | String | No | - | |
dnsStatus | Json | No | - | |
createdAt | DateTime | Yes | now( | |
updatedAt | DateTime | Yes | - | |
verificationToken | String | No | - | |
verifiedAt | DateTime | No | - | |
dnsRecords | Json | No | - | |
verificationType | String | No | "domain" | |
isInboxHosted | Boolean | Yes | false | Column: is_inbox_hosted |
mxVerified | Boolean | Yes | false | Column: mx_verified |
mxVerifiedAt | DateTime | No | - | Column: mx_verified_at |
mxCheckedAt | DateTime | No | - | Column: mx_checked_at |
catchAllEnabled | Boolean | Yes | false | Column: catch_all_enabled |
mailboxes | Mailbox[] | Yes | - | |
aliases | MailboxAlias[] | Yes | - | |
addons | DomainAddon[] | Yes | - | |
inboxUsers | InboxUser[] | Yes | - |
Unique constraints: (userId, hostname)
SystemDomain
Table: system_domains
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
domain | String | Yes | - | Unique |
poolType | PoolType | Yes | - | Column: pool_type |
isActive | Boolean | Yes | true | |
dkimSelector | String | Yes | "default" | |
dkimPublicKey | String | No | - | |
createdAt | DateTime | Yes | now( | |
updatedAt | DateTime | Yes | - |
SubdomainSlot
Table: subdomain_slots
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
subdomain | String | Yes | - | |
parentDomain | String | Yes | - | Column: parent_domain |
category | String | Yes | - | |
isAssigned | Boolean | Yes | false | Column: is_assigned |
assignedUserId | String | No | - | Column: assigned_user_id |
assignedAt | DateTime | No | - | Column: assigned_at |
createdAt | DateTime | Yes | now( | Column: created_at |
Unique constraints: (subdomain, parentDomain)
Mailbox
Table: mailboxes
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
prefix | String | Yes | - | |
userId | String | Yes | - | Column: user_id |
domainId | String | Yes | - | Column: domain_id |
isRelayEnabled | Boolean | Yes | true | Column: is_relay_enabled |
isInboxEnabled | Boolean | Yes | false | Column: is_inbox_enabled |
quotaBytes | BigInt | Yes | 1073741824 | Column: quota_bytes |
dailySendLimit | Int | Yes | 100 | Column: daily_send_limit |
lastUsedAt | DateTime | No | - | Column: last_used_at |
createdAt | DateTime | Yes | now( | Column: created_at |
Unique constraints: (prefix, domainId)
MailboxAlias
Table: mailbox_aliases
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
alias | String | Yes | - | Unique |
prefix | String | Yes | - | |
userId | String | Yes | - | Column: user_id |
domainId | String | Yes | - | Column: domain_id |
active | Boolean | Yes | true | |
createdAt | DateTime | Yes | now( | Column: created_at |
InboxUser
Table: inbox_users
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
ownerId | String | Yes | - | Column: owner_id |
domainId | String | Yes | - | Column: domain_id |
email | String | Yes | - | Unique |
localPart | String | Yes | - | Column: local_part |
displayName | String | No | - | Column: display_name |
passwordHash | String | Yes | - | Column: password_hash |
allowedUsernames | String[] | Yes | [] | Column: allowed_usernames |
allowedDomainIds | String[] | Yes | [] | Column: allowed_domain_ids |
stalwartPrincipalId | String | No | - | Unique, Column: stalwart_principal_id |
quotaBytes | BigInt | Yes | 1073741824 | Column: quota_bytes |
usedBytes | BigInt | Yes | 0 | Column: used_bytes |
dailySendLimit | Int | Yes | 100 | Column: daily_send_limit |
dailySentCount | Int | Yes | 0 | Column: daily_sent_count |
status | InboxUserStatus | Yes | ACTIVE | |
mustChangePassword | Boolean | Yes | false | Column: must_change_password |
lastLoginAt | DateTime | No | - | Column: last_login_at |
lastSentAt | DateTime | No | - | Column: last_sent_at |
createdAt | DateTime | Yes | now( | Column: created_at |
updatedAt | DateTime | Yes | - | Column: updated_at |
aliases | InboxUserAlias[] | Yes | - |
InboxUserAlias
Table: inbox_user_aliases
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
inboxUserId | String | Yes | - | Column: inbox_user_id |
alias | String | Yes | - | Unique |
localPart | String | Yes | - | Column: local_part |
active | Boolean | Yes | true | |
createdAt | DateTime | Yes | now( | Column: created_at |
Table: emails
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
messageId | String | Yes | - | Unique, Column: message_id |
userId | String | Yes | - | Column: user_id |
fromEmail | String | Yes | - | Column: from_email |
fromName | String | No | - | Column: from_name |
toRecipients | Json | Yes | - | Column: to_recipients |
ccRecipients | Json | No | - | Column: cc_recipients |
bccRecipients | Json | No | - | Column: bcc_recipients |
replyTo | Json | No | - | Column: reply_to |
subject | String | Yes | - | |
htmlContent | String | No | - | Column: html_content |
textContent | String | No | - | Column: text_content |
attachments | Json | No | - | |
status | email_status | Yes | Queued | |
poolType | PoolType | Yes | - | Column: pool_type |
poolTier | PlanTier | Yes | - | Column: pool_tier |
categories | Json | No | - | |
tags | Json | No | - | |
source | email_source | No | - | Column: source |
queuedAt | DateTime | Yes | now( | Column: queued_at |
sentAt | DateTime | No | - | Column: sent_at |
deliveredAt | DateTime | No | - | Column: delivered_at |
createdAt | DateTime | Yes | now( | Column: created_at |
updatedAt | DateTime | Yes | - | Column: updated_at |
batchId | String | No | - | Column: batch_id |
emailEvents | EmailEvent[] | Yes | - |
EmailEvent
Table: email_events
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
emailId | String | Yes | - | Column: email_id |
messageId | String | Yes | - | Column: message_id |
eventType | event_type | Yes | - | Column: event_type |
timestamp | DateTime | Yes | now( | |
processedAt | DateTime | Yes | now( | Column: processed_at |
recipient | String | No | - | |
sender | String | No | - | |
subject | String | No | - | |
details | Json | No | - | |
statusCode | String | No | - | Column: status_code |
statusMessage | String | No | - | Column: status_message |
rawPayload | Json | No | - | Column: raw_payload |
userId | String | No | - | Column: user_id |
poolType | PoolType | No | - | Column: pool_type |
queuedAt | DateTime | No | - | Column: queued_at |
ScheduledEmail
Table: scheduled_emails
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
messageId | String | Yes | - | Unique, Column: message_id |
userId | String | Yes | - | Column: user_id |
emailData | Json | Yes | - | Column: email_data |
scheduledFor | DateTime | Yes | - | Column: scheduled_for |
status | scheduled_status | Yes | Pending | |
sentAt | DateTime | No | - | Column: sent_at |
createdAt | DateTime | Yes | now( | Column: created_at |
updatedAt | DateTime | Yes | - | Column: updated_at |
Suppression
Table: suppressions
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
userId | String | Yes | - | Column: user_id |
email | String | Yes | - | |
reason | suppression_reason | Yes | - | |
details | Json | No | - | |
createdAt | DateTime | Yes | now( | Column: created_at |
Unique constraints: (userId, email)
Template
Table: templates
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
userId | String | Yes | - | Column: user_id |
name | String | Yes | - | |
subject | String | Yes | - | |
htmlContent | String | No | - | Column: html_content |
textContent | String | No | - | Column: text_content |
version | Int | Yes | 1 | |
variables | Json | No | - | |
extractedVariables | Json | No | - | Column: extracted_variables |
variablesLastExtracted | DateTime | No | - | Column: variables_last_extracted |
testData | Json | No | - | Column: test_data |
mjmlContent | String | No | - | Column: mjml_content |
format | template_format | Yes | BLOCKS | Column: format |
blockContent | Json | No | - | Column: block_content |
category | TemplateCategory | Yes | OTHER | |
themeId | String | No | - | Column: theme_id |
createdAt | DateTime | Yes | now( | Column: created_at |
updatedAt | DateTime | Yes | - | Column: updated_at |
versions | TemplateVersion[] | Yes | - | |
campaigns | Campaign[] | Yes | - |
Unique constraints: (userId, name, version)
TemplateVersion
Table: template_versions
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
templateId | String | Yes | - | Column: template_id |
version | Int | Yes | - | |
userId | String | Yes | - | Column: user_id |
name | String | Yes | - | |
subject | String | Yes | - | |
htmlContent | String | No | - | Column: html_content |
textContent | String | No | - | Column: text_content |
variables | Json | No | - | |
blockContent | Json | No | - | Column: block_content |
createdAt | DateTime | Yes | now( | Column: created_at |
Unique constraints: (templateId, version)
BrandTheme
Table: brand_themes
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
userId | String | Yes | - | Column: user_id |
name | String | Yes | "Default" | |
isDefault | Boolean | Yes | false | Column: is_default |
primaryColor | String | Yes | "#0070f3" | Column: primary_color |
secondaryColor | String | Yes | "#1a1a1a" | Column: secondary_color |
accentColor | String | Yes | "#00c2ff" | Column: accent_color |
fontFamily | String | Yes | "-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif" | Column: font_family |
fontName | String | Yes | "System" | Column: font_name |
logoUrl | String | No | - | Column: logo_url |
companyName | String | Yes | "My Company" | Column: company_name |
footerHtml | String | No | - | Column: footer_html |
socialLinks | Json | No | - | Column: social_links |
bgColor | String | Yes | "#f8fafc" | Column: bg_color |
cardBgColor | String | Yes | "#ffffff" | Column: card_bg_color |
headingColor | String | Yes | "#0f172a" | Column: heading_color |
textColor | String | Yes | "#475569" | Column: text_color |
mutedColor | String | Yes | "#94a3b8" | Column: muted_color |
borderRadius | String | Yes | "8px" | Column: border_radius |
buttonRadius | String | Yes | "8px" | Column: button_radius |
buttonStyle | String | Yes | "filled" | Column: button_style |
designStyle | String | Yes | "default" | Column: design_style |
defaultFromName | String | No | - | Column: default_from_name |
defaultFromEmail | String | No | - | Column: default_from_email |
trackingDomain | String | No | - | Column: tracking_domain |
trackingDomainVerified | Boolean | Yes | false | Column: tracking_domain_verified |
unsubscribePageTitle | String | No | - | Column: unsubscribe_page_title |
unsubscribePageMessage | String | No | - | Column: unsubscribe_page_message |
createdAt | DateTime | Yes | now( | Column: created_at |
updatedAt | DateTime | Yes | - | Column: updated_at |
templates | Template[] | Yes | - | |
campaigns | Campaign[] | Yes | - |
Unique constraints: (userId, name)
UnsubscribePreference
Table: unsubscribe_preferences
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
userId | String | Yes | - | Column: user_id |
contactEmail | String | Yes | - | Column: contact_email |
category | String | No | - | |
createdAt | DateTime | Yes | now( | Column: created_at |
Unique constraints: (userId, contactEmail, category)
Webhook
Table: webhooks
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
userId | String | Yes | - | Column: user_id |
url | String | Yes | - | |
events | Json | Yes | - | |
description | String | No | - | |
active | Boolean | Yes | true | |
secretHash | String | Yes | - | Column: secret_hash |
secretPrefix | String | Yes | - | Column: secret_prefix |
previousSecretHash | String | No | - | Column: previous_secret_hash |
previousSecretValidUntil | DateTime | No | - | Column: previous_secret_valid_until |
failureNotify | Boolean | Yes | false | Column: failure_notify |
failureEmails | Json | No | - | Column: failure_emails |
failureThreshold | Int | Yes | 5 | Column: failure_threshold |
autoDisableAfter | Int | Yes | 0 | Column: auto_disable_after |
createdAt | DateTime | Yes | now( | Column: created_at |
updatedAt | DateTime | Yes | - | Column: updated_at |
webhookDeliveries | WebhookDelivery[] | Yes | - |
WebhookDelivery
Table: webhook_deliveries
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
webhookId | String | Yes | - | Column: webhook_id |
eventId | String | No | - | Column: event_id |
deliveredAt | DateTime | Yes | now( | Column: delivered_at |
statusCode | Int | Yes | - | Column: status_code |
success | Boolean | Yes | - | |
retries | Int | Yes | 0 | |
responseTime | Int | No | - | Column: response_time |
errorMessage | String | No | - | Column: error_message |
AbuseReport
Table: abuse_reports
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
userId | String | Yes | - | |
reporterEmail | String | No | - | |
reportType | String | Yes | - | |
priority | AbuseReportPriority | Yes | LOW | |
status | AbuseReportStatus | Yes | OPEN | |
subject | String | No | - | |
description | String | Yes | - | |
evidence | Json | No | - | |
sourceIp | String | No | - | |
assignedTo | String | No | - | |
resolution | String | No | - | |
resolvedAt | DateTime | No | - | |
createdAt | DateTime | Yes | now( | |
updatedAt | DateTime | Yes | - | |
notes | AdminNote[] | Yes | - |
AdminNote
Table: admin_notes
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
adminEmail | String | Yes | - | |
content | String | Yes | - | |
isInternal | Boolean | Yes | true | |
abuseReportId | String | Yes | - | |
createdAt | DateTime | Yes | now( |
ReputationScore
Table: reputation_scores
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
userId | String | Yes | - | Unique |
score | Int | Yes | 100 | |
trend | ReputationTrend | Yes | STABLE | |
pool | PoolType | Yes | Shared | |
bounceRate | Float | Yes | 0 | |
complaintRate | Float | Yes | 0 | |
volumeToday | Int | Yes | 0 | |
volumeWeek | Int | Yes | 0 | |
activeIncidents | Int | Yes | 0 | |
lastIncidentAt | DateTime | No | - | |
calculatedAt | DateTime | Yes | now( | |
createdAt | DateTime | Yes | now( | |
updatedAt | DateTime | Yes | - | |
history | ReputationHistory[] | Yes | - | |
incidents | ReputationIncident[] | Yes | - |
ReputationHistory
Table: reputation_history
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
reputationId | String | Yes | - | |
date | DateTime | Yes | - | |
score | Int | Yes | - | |
bounceRate | Float | Yes | 0 | |
complaintRate | Float | Yes | 0 | |
volume | Int | Yes | 0 | |
delta | Int | Yes | 0 | |
createdAt | DateTime | Yes | now( |
Unique constraints: (reputationId, date)
ReputationIncident
Table: reputation_incidents
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
reputationId | String | Yes | - | |
type | String | Yes | - | |
severity | IncidentSeverity | Yes | WARNING | |
impact | Int | Yes | - | |
description | String | Yes | - | |
resolved | Boolean | Yes | false | |
resolvedAt | DateTime | No | - | |
resolution | String | No | - | |
createdAt | DateTime | Yes | now( |
SystemAlert
Table: system_alerts
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
alertType | String | Yes | - | Column: alert_type |
severity | String | Yes | - | |
status | String | Yes | "Unread" | |
title | String | Yes | - | |
message | String | Yes | - | |
details | Json | No | - | |
source | String | Yes | - | |
acknowledged | Boolean | Yes | false | |
acknowledgedBy | String | No | - | Column: acknowledged_by |
acknowledgedAt | DateTime | No | - | Column: acknowledged_at |
resolvedAt | DateTime | No | - | Column: resolved_at |
createdAt | DateTime | Yes | now( | Column: created_at |
SystemConfig
Table: system_config
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
key | String | Yes | - | Unique |
value | Json | Yes | - | |
updatedBy | String | Yes | - | Column: updated_by |
updatedAt | DateTime | Yes | now( | Column: updated_at |
MaintenanceWindow
Table: maintenance_windows
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
title | String | Yes | - | |
description | String | No | - | |
startTime | DateTime | Yes | - | Column: start_time |
endTime | DateTime | Yes | - | Column: end_time |
status | maintenance_window_status | Yes | Scheduled | |
impactLevel | String | Yes | "Low" | Column: impact_level |
createdBy | String | Yes | - | Column: created_by |
createdAt | DateTime | Yes | now( | Column: created_at |
updatedAt | DateTime | Yes | - | Column: updated_at |
BackupLog
Table: backup_logs
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
backupType | String | Yes | - | Column: backup_type |
status | backup_status | Yes | Running | |
sizeBytes | BigInt | No | - | Column: size_bytes |
duration | Int | No | - | |
location | String | No | - | |
errorMessage | String | No | - | Column: error_message |
triggeredBy | String | Yes | - | Column: triggered_by |
startedAt | DateTime | Yes | now( | Column: started_at |
completedAt | DateTime | No | - | Column: completed_at |
retentionDays | Int | Yes | 90 | Column: retention_days |
AlertConfiguration
Table: alert_configurations
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
alertType | String | Yes | - | Unique, Column: alert_type |
enabled | Boolean | Yes | true | |
threshold | Json | Yes | - | |
severity | String | Yes | "Medium" | |
channels | Json | Yes | "[]" | |
recipients | Json | Yes | "[]" | |
description | String | No | - | |
updatedBy | String | Yes | - | Column: updated_by |
updatedAt | DateTime | Yes | now( | Column: updated_at |
createdAt | DateTime | Yes | now( | Column: created_at |
Invoice
Table: invoices
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
userId | String | Yes | - | |
amount | Decimal | Yes | - | |
currency | String | Yes | "CAD" | |
status | invoice_status | Yes | Pending | |
pdfUrl | String | No | - | |
periodStart | DateTime | Yes | - | |
periodEnd | DateTime | Yes | - | |
stripeInvoiceId | String | No | - | |
createdAt | DateTime | Yes | now( |
EmailBatch
Table: email_batches
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
userId | String | Yes | - | Column: user_id |
status | batch_status | Yes | Pending | |
totalCount | Int | Yes | - | Column: total_count |
sentCount | Int | Yes | 0 | Column: sent_count |
failedCount | Int | Yes | 0 | Column: failed_count |
scheduleMode | String | Yes | "immediate" | Column: schedule_mode |
metadata | Json | No | - | |
createdAt | DateTime | Yes | now( | Column: created_at |
completedAt | DateTime | No | - | Column: completed_at |
emails | Email[] | Yes | - |
SuppressionGroup
Table: suppression_groups
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
userId | String | Yes | - | Column: user_id |
name | String | Yes | - | |
description | String | No | - | |
isDefault | Boolean | Yes | false | Column: is_default |
createdAt | DateTime | Yes | now( | Column: created_at |
updatedAt | DateTime | Yes | - | Column: updated_at |
members | SuppressionGroupMember[] | Yes | - |
Unique constraints: (userId, name)
SuppressionGroupMember
Table: suppression_group_members
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
groupId | String | Yes | - | Column: group_id |
email | String | Yes | - | |
createdAt | DateTime | Yes | now( | Column: created_at |
Unique constraints: (groupId, email)
DedicatedIp
Table: dedicated_ips
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
userId | String | Yes | - | Column: user_id |
address | String | Yes | - | Unique |
hostname | String | No | - | |
warmup | Boolean | Yes | false | |
warmupStartedAt | DateTime | No | - | Column: warmup_started_at |
createdAt | DateTime | Yes | now( | Column: created_at |
updatedAt | DateTime | Yes | - | Column: updated_at |
pools | IpPoolIp[] | Yes | - |
IpPool
Table: ip_pools
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
userId | String | Yes | - | Column: user_id |
name | String | Yes | - | |
isDefault | Boolean | Yes | false | Column: is_default |
createdAt | DateTime | Yes | now( | Column: created_at |
updatedAt | DateTime | Yes | - | Column: updated_at |
ips | IpPoolIp[] | Yes | - |
Unique constraints: (userId, name)
IpPoolIp
Table: ip_pool_ips
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
poolId | String | Yes | - | Column: pool_id |
ipId | String | Yes | - | Column: ip_id |
Unique constraints: (poolId, ipId)
Subuser
Table: subusers
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
userId | String | Yes | - | Column: user_id |
username | String | Yes | - | Unique |
email | String | Yes | - | |
status | subuser_status | Yes | Active | |
permissions | Json | No | - | |
rateLimit | Int | No | - | Column: rate_limit |
ipPoolId | String | No | - | Column: ip_pool_id |
apiKeyHash | String | No | - | Unique, Column: api_key_hash |
createdAt | DateTime | Yes | now( | Column: created_at |
updatedAt | DateTime | Yes | - | Column: updated_at |
RevokedToken
Table: revoked_tokens
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
jti | String | Yes | - | Unique |
userId | String | Yes | - | Column: user_id |
expiresAt | DateTime | Yes | - | Column: expires_at |
revokedAt | DateTime | Yes | now( | Column: revoked_at |
Contact
Table: contacts
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
userId | String | Yes | - | Column: user_id |
email | String | Yes | - | |
firstName | String | No | - | Column: first_name |
lastName | String | No | - | Column: last_name |
phone | String | No | - | |
metadata | Json | No | - | |
source | ContactSource | Yes | - | |
status | ContactStatus | Yes | ACTIVE | |
subscribedAt | DateTime | Yes | now( | Column: subscribed_at |
unsubscribedAt | DateTime | No | - | Column: unsubscribed_at |
createdAt | DateTime | Yes | now( | Column: created_at |
updatedAt | DateTime | Yes | - | Column: updated_at |
tags | ContactTag[] | Yes | - | |
customFields | ContactCustomField[] | Yes | - | |
listMemberships | ContactListMember[] | Yes | - | |
campaignEvents | CampaignEvent[] | Yes | - | |
campaignRecipients | CampaignRecipient[] | Yes | - |
Unique constraints: (userId, email)
ContactTag
Table: contact_tags
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
contactId | String | Yes | - | Column: contact_id |
tag | String | Yes | - |
Unique constraints: (contactId, tag)
ContactCustomField
Table: contact_custom_fields
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
contactId | String | Yes | - | Column: contact_id |
key | String | Yes | - | |
value | String | Yes | - |
Unique constraints: (contactId, key)
Campaign
Table: campaigns
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
userId | String | Yes | - | Column: user_id |
name | String | Yes | - | |
subject | String | Yes | - | |
preheaderText | String | No | - | Column: preheader_text |
fromName | String | Yes | - | Column: from_name |
fromEmail | String | Yes | - | Column: from_email |
replyTo | String | No | - | Column: reply_to |
templateId | String | No | - | Column: template_id |
htmlContent | String | No | - | Column: html_content |
textContent | String | No | - | Column: text_content |
themeId | String | No | - | Column: theme_id |
templateVariables | Json | No | - | Column: template_variables |
status | CampaignStatus | Yes | - | |
approvalStatus | ApprovalStatus | Yes | DRAFT | Column: approval_status |
approvedBy | String | No | - | Column: approved_by |
approvedAt | DateTime | No | - | Column: approved_at |
reviewNotes | String | No | - | Column: review_notes |
scheduledFor | DateTime | No | - | Column: scheduled_for |
sentAt | DateTime | No | - | Column: sent_at |
completedAt | DateTime | No | - | Column: completed_at |
sendWindow | Json | No | - | Column: send_window |
maxRecipients | Int | No | - | Column: max_recipients |
estimatedCost | Decimal | No | - | Column: estimated_cost |
abTestEnabled | Boolean | Yes | false | Column: ab_test_enabled |
abTestConfig | Json | No | - | Column: ab_test_config |
trackOpens | Boolean | Yes | true | Column: track_opens |
trackClicks | Boolean | Yes | true | Column: track_clicks |
totalRecipients | Int | Yes | 0 | Column: total_recipients |
sentCount | Int | Yes | 0 | Column: sent_count |
deliveredCount | Int | Yes | 0 | Column: delivered_count |
openedCount | Int | Yes | 0 | Column: opened_count |
clickedCount | Int | Yes | 0 | Column: clicked_count |
bouncedCount | Int | Yes | 0 | Column: bounced_count |
complainedCount | Int | Yes | 0 | Column: complained_count |
unsubscribedCount | Int | Yes | 0 | Column: unsubscribed_count |
parentId | String | No | - | Column: parent_id |
createdAt | DateTime | Yes | now( | Column: created_at |
updatedAt | DateTime | Yes | - | Column: updated_at |
recipients | CampaignRecipient[] | Yes | - | |
events | CampaignEvent[] | Yes | - |
ContactList
Table: contact_lists
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
userId | String | Yes | - | Column: user_id |
ownerId | String | Yes | - | Column: owner_id |
name | String | Yes | - | |
description | String | No | - | |
type | ListType | Yes | - | |
segmentRules | Json | No | - | Column: segment_rules |
contactCount | Int | Yes | 0 | Column: contact_count |
isArchived | Boolean | Yes | false | Column: is_archived |
archivedAt | DateTime | No | - | Column: archived_at |
metadata | Json | No | - | |
lastSyncedAt | DateTime | No | - | Column: last_synced_at |
createdAt | DateTime | Yes | now( | Column: created_at |
updatedAt | DateTime | Yes | - | Column: updated_at |
members | ContactListMember[] | Yes | - | |
campaigns | CampaignRecipient[] | Yes | - |
Unique constraints: (userId, name)
ContactListMember
Table: contact_list_members
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
contactId | String | Yes | - | Column: contact_id |
listId | String | Yes | - | Column: list_id |
addedAt | DateTime | Yes | now( | Column: added_at |
addedBy | String | No | - | Column: added_by |
removedAt | DateTime | No | - | Column: removed_at |
removedBy | String | No | - | Column: removed_by |
Unique constraints: (contactId, listId)
CampaignRecipient
Table: campaign_recipients
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
campaignId | String | Yes | - | Column: campaign_id |
listId | String | No | - | Column: list_id |
contactId | String | No | - | Column: contact_id |
excluded | Boolean | Yes | false | |
status | CampaignRecipientStatus | Yes | PENDING | |
sentAt | DateTime | No | - | Column: sent_at |
deliveredAt | DateTime | No | - | Column: delivered_at |
openedAt | DateTime | No | - | Column: opened_at |
clickedAt | DateTime | No | - | Column: clicked_at |
bouncedAt | DateTime | No | - | Column: bounced_at |
Unique constraints: (campaignId, listId), (campaignId, contactId)
CampaignEvent
Table: campaign_events
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
campaignId | String | Yes | - | Column: campaign_id |
contactId | String | Yes | - | Column: contact_id |
event | CampaignEventType | Yes | - | |
metadata | Json | No | - | |
ipAddress | String | No | - | Column: ip_address |
userAgent | String | No | - | Column: user_agent |
occurredAt | DateTime | Yes | now( | Column: occurred_at |
DomainAddon
Table: domain_addons
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
domainId | String | Yes | - | Column: domain_id |
userId | String | Yes | - | Column: user_id |
addonType | AddonType | Yes | - | Column: addon_type |
status | AddonStatus | Yes | ACTIVE | |
pricePerMonth | Int | Yes | 1000 | Column: price_per_month |
stripeSubscriptionId | String | No | - | Column: stripe_subscription_id |
stripeItemId | String | No | - | Column: stripe_item_id |
enabledAt | DateTime | Yes | now( | Column: enabled_at |
cancelledAt | DateTime | No | - | Column: cancelled_at |
expiresAt | DateTime | No | - | Column: expires_at |
metadata | Json | No | - |
Unique constraints: (domainId, addonType)
PendingSignup
Table: pending_signups
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
token | String | Yes | - | Unique |
email | String | Yes | - | |
passwordHash | String | Yes | - | Column: password_hash |
companyName | String | Yes | - | Column: company_name |
subdomain | String | Yes | - | |
selectedDomain | String | Yes | - | Column: selected_domain |
planTier | String | Yes | - | Column: plan_tier |
createdAt | DateTime | Yes | now( | Column: created_at |
expiresAt | DateTime | Yes | - | Column: expires_at |
SystemSetting
Table: system_settings
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
id | String | Yes | cuid( | Primary Key |
key | String | Yes | - | Unique |
value | Json | Yes | - | |
description | String | No | - | |
category | String | Yes | "general" | |
isPublic | Boolean | Yes | false | Column: is_public |
updatedAt | DateTime | Yes | - | Column: updated_at |
updatedBy | String | No | - | Column: updated_by |
Enums
template_format
| Value |
|---|
LEGACY |
BLOCKS |
TemplateCategory
| Value |
|---|
TRANSACTIONAL |
AUTHENTICATION |
NOTIFICATION |
SECURITY |
MARKETING |
OTHER |
email_status
| Value |
|---|
Queued |
Processing |
Sent |
Delivered |
Bounced |
Failed |
Deferred |
email_source
| Value |
|---|
API |
INBOX |
SMTP |
INBOUND |
SCHEDULED |
TEST |
event_type
| Value |
|---|
Queued |
Processing |
Sent |
Delivered |
Bounced |
Deferred |
Dropped |
Opened |
Clicked |
SpamComplaint |
Unsubscribed |
scheduled_status
| Value |
|---|
Pending |
Sent |
Cancelled |
Failed |
batch_status
| Value |
|---|
Pending |
Processing |
Completed |
PartialFailure |
Failed |
suppression_reason
| Value |
|---|
Bounce |
Complaint |
Unsubscribe |
Manual |
PlanTier
| Value |
|---|
Free |
Starter |
Micro |
Pro |
Scale |
Enterprise |
PoolType
| Value |
|---|
Shared |
Isolated |
Dedicated |
DomainType
| Value |
|---|
SYSTEM_SUBDOMAIN |
CUSTOM |
INFRASTRUCTURE |
ReputationTrend
| Value |
|---|
STABLE |
IMPROVING |
DECLINING |
IncidentSeverity
| Value |
|---|
INFO |
WARNING |
CRITICAL |
user_role
| Value |
|---|
USER @map("User") |
ADMIN @map("Admin") |
SUPER_ADMIN @map("SuperAdmin") |
account_type
| Value |
|---|
USER @map("User") |
SERVICE @map("Service") |
SYSTEM @map("System") |
user_status
| Value |
|---|
ACTIVE @map("Active") |
SUSPENDED @map("Suspended") |
BANNED @map("Banned") |
InboxUserStatus
| Value |
|---|
ACTIVE @map("Active") |
SUSPENDED @map("Suspended") |
DELETED @map("Deleted") |
AbuseReportStatus
| Value |
|---|
OPEN @map("Open") |
REVIEWING @map("Reviewing") |
RESOLVED @map("Resolved") |
DISMISSED @map("Dismissed") |
AbuseReportPriority
| Value |
|---|
LOW @map("Low") |
MEDIUM @map("Medium") |
HIGH @map("High") |
CRITICAL @map("Critical") |
invoice_status
| Value |
|---|
Pending |
Paid |
Failed |
Refunded |
maintenance_window_status
| Value |
|---|
Scheduled |
InProgress |
Completed |
Cancelled |
backup_status
| Value |
|---|
Running |
Completed |
Failed |
Cancelled |
subuser_status
| Value |
|---|
Active |
Suspended |
ContactSource
| Value |
|---|
MANUAL |
CSV_IMPORT |
API |
FORM |
SYNC |
ContactStatus
| Value |
|---|
ACTIVE |
UNSUBSCRIBED |
BOUNCED |
COMPLAINED |
CLEANED |
CampaignStatus
| Value |
|---|
DRAFT |
SCHEDULED |
SENDING |
SENT |
PAUSED |
CANCELLED |
ApprovalStatus
| Value |
|---|
DRAFT |
PENDING_REVIEW |
APPROVED |
REJECTED |
ListType
| Value |
|---|
STATIC |
DYNAMIC |
CampaignRecipientStatus
| Value |
|---|
PENDING |
SENDING |
SENT |
DELIVERED |
FAILED |
BOUNCED |
CampaignEventType
| Value |
|---|
SENT |
DELIVERED |
OPENED |
CLICKED |
BOUNCED |
COMPLAINED |
UNSUBSCRIBED |
FAILED |
AddonType
| Value |
|---|
INBOX_HOSTING |
DEDICATED_IP |
ADVANCED_ANALYTICS |
CUSTOM_DKIM |
AddonStatus
| Value |
|---|
ACTIVE |
CANCELLED |
EXPIRED |
PENDING_PAYMENT |