Skip to content

Enumerated Types

The database uses PostgreSQL enum types for better type safety and data consistency. All enums were converted from CHECK constraints in migration 20250912113410_convert_check_constraints_to_enums.sql.

Entity Types

  • entity_type: Person, Business

User & Settings

  • theme_type: light, dark, system

Projects & Production

  • project_relationship_status: Invited, Active, Inactive, Declined
  • budget_status: Draft, Active, Superseded, Archived
  • schedule_status: Draft, Proposed, Approved, Active, Superseded, Archived
  • production_phase_type: Pre-Production, Shooting, Post-Production
  • day_type: Working, Travel, Rest
  • exchange_rate_mode: live, stamped — project-wide (projects.exchange_rate_mode, default stamped) choice of how foreign-currency transaction amounts convert to the project currency. live uses the currently-active project rate (corrections self-heal every figure); stamped uses the immutable rate version each transaction was processed under (transactions.exchange_rate_id), freezing already-processed figures. Read by resolve_transaction_exchange_rate.

Crew & Forms

  • employment_type: employee, self_employed, loan_out, other — how a crew member is engaged on a project relationship. UI labels this with country-specific copy (UK: PAYE / UTR / Loan-out; India: TDS / PAN / Through a Company) but the canonical enum values are these four
  • form_submission_status: requested, in_progress, submitted, superseded, cancelled — lifecycle of a form dispatch
  • form_submission_promotion_status: pending, running, applied — state of the async, retryable promotion step that folds a completed submission's data into entities/relationships/attachments. NULL on form_submissions.promotion_status = legacy/not-applicable (completed before async promotion, or not yet final)
  • entity_association_type: billing_authority, employee_of, director_of, contractor_of, other — the nature of a directed entity-to-entity relationship

Financial & Documents

  • document_type: Tax Invoice, Receipt, Proforma Invoice, Quote, Purchase Order, Other
  • transaction_type_enum: Expense, Invoice, Payroll Invoice, Reimbursement, Unknown
  • transaction_direction: inbound, outbound - Indicates if a transaction represents money coming in (received) or going out (sent)
  • transaction_status: Received, Processing, In Approval, Approved, Rejected, Queried, Cancelled, Paid, On HoldOn Hold means processing halted because the transaction is in a foreign currency with no project exchange rate; it resumes (and leaves this status) once a rate is set and the transaction is reprocessed.
  • payment_status: Scheduled, Paid, Cancelled
  • payment_reconciliation_status: Active, Voided - Soft-delete lifecycle for a reconciliation row. Voided rows are retained for history but excluded from every balance, payment total, allocation-cap check, and listing. Set when the linked transaction is voided while the payment keeps other allocations.
  • ~~bank_account_type~~: dropped by migration 20260505231911_add_payment_details_to_entities_and_relationships.sql. The personal / business value is now stored as the account_holder string field inside entities.payment_details and project_relationships.payment_details
  • payment_method_type: Card, Bank Account, Petty Cash Float
  • card_type: Debit, Credit
  • payroll_classification: Salary/Fee, Overtime, Equipment, Expenses, Combination, `` (empty string)
  • accounting_breakdown: Above the Line, Below the Line
  • line_item_processing_mode: detailed, summary — the line-item processing mode the pipeline applied to a transaction. detailed keeps every source line; summary condenses them into a summarised set. Stored on transactions.line_item_mode (nullable — NULL means the transaction was processed before the mode system existed and is semantically detailed) and taken directly as the third parameter of replace_transaction_line_items, so the type is the single source of truth for the domain (no CHECK constraint restates it). The per-project default lives under projects.metadata.transaction.<type>.line_item_processing.

Communication

  • channel_type: whatsapp, email, in_app
  • conversation_status: active, archived, blocked, current
  • instance_status: active, closed, summarized
  • close_reason: message_limit, time_limit, abuse_detected, manual
  • sentiment_type: positive, neutral, negative, mixed
  • message_direction: inbound, outbound, internal
  • message_sender_type: user, assistant, system, functions, tool, tool_calls
  • delivery_status: pending, sent, delivered, read, failed
  • notification_sender_type: email, phone
  • message_outbox_send_kind: message, media, template, interactive_url_button, interactive_list, location_request, flow, read_receipt — which provider client call an outbox row replays; determines how the channel dispatcher interprets payload
  • message_outbox_state: pending, sending, accepted, failed, ambiguous — lifecycle of an outbound send intent. pending = queued; sending = claimed by a dispatcher; accepted = provider acknowledged; failed = terminal without acceptance; ambiguous = outcome unknown mid-wire, never retried and never pruned
  • message_outbox_attempt_outcome: accepted, failed_retryable, failed_permanent, ambiguous — verdict of one wire attempt; NULL on an attempt row means the attempt is still in flight

The message outbox deliberately defines no channel enum of its ownmessage_outbox.channel and message_outbox_pairs.channel are typed channel_type (above), so the outbox, conversations and notifications all name a delivery channel with the same values and a second channel needs no schema change.

System & Security

  • data_source: Email, WhatsApp, Manual, CSV, System
  • abuse_action_type: warning, throttle, suspend, block, report
  • abuse_pattern_type: spam, flooding, gibberish, profanity, phishing, api_abuse
  • rate_limit_type: per_minute, per_hour, per_day, per_instance
  • rate_limit_user_type: all, new, verified, premium

AI Processing

  • processable_type: transactions, budgets, schedules
  • failure_action: fail_job, skip_dependents, continue
  • job_status: pending, in_progress, completed, failed, partial_success
  • step_status: pending, ready, in_progress, completed, failed, skipped, not_needed
  • processing_issue_status: pending, requested, resolved, ignored
  • processing_issue_severity: critical, high, medium, low
  • processing_issue_template_action: ignore, supersede — what a process template does to a registered issue kind's PENDING rows when it is dispatched (process_template_issue_actions.action). ignore sets status = ignored; supersede additionally clears is_current, dropping the row from default list surfaces. Both affect pending rows only.

No transaction_type_key enum exists, deliberately. Issue applicability and the per-project settings/fallback tables scope by the PAIR transaction_type (existing enum) + direction transaction_direction NULL, with a cross-column CHECK making direction present exactly when the type is Invoice. The six direction-aware string keys (Invoice_inbound, …) remain a TS/UI-only concept. Adding a parallel key enum would mean maintaining two spellings of the same taxonomy.

Tagging

  • tag_category: Compliance, Transaction

Export System

  • export_status: pending, processing, completed, failed
  • export_type: transactions, compliance, attachments, message, datatable, project_relationship, payment_request_sheet

Access Control

  • access_status: Active, Invited, Revoked
  • grant_type: role, permission
  • scope_type: organisation, project - Used for user access scope and permission/role scope

Approval

  • approval_status: Pending, Approved, Rejected, Skipped, Cancelled, Queried - Status of approval requests and instances. Skipped = workflow auto-skip (tier conditions, same-tier). Cancelled = user-initiated cancellation (document replaced, duplicate detected)
  • menu_type: main, sidebar, dropdown, quickaction, sana

Integrations

  • integration_auth_method: oauth2, api_key, basic_auth, saml, jwt, certificate, webhook, none
  • integration_credential_scope: global, per_project
  • integration_connection_status: Connected, Disconnected, Error, Expired, Pending
  • sync_trigger_type: on_status_change, on_manual, on_schedule, on_link, realtime
  • sync_status: pending, in_progress, success, partial_success, failed
  • sync_direction: inbound, outbound, bidirectional
  • integration_feature_category: tax_validation, company_validation, company_details - Categorizes integration features by purpose. company_details features store results in project_integrations.external_account_name + external_metadata instead of integration_reference_data

Attachments

  • entity_attachment_type: identity_document, certificate, photo, signature, bank_details, tax_document, insurance, license, other — note: contract was removed in migration 20260403000000_create_project_relationship_attachments.sql because contracts now belong to a specific project relationship, not the entity globally
  • project_relationship_attachment_type: identity_document, contract, starter_form, proof_of_work, certificate, tax_document, bank_details, other — relationship-scoped attachment categories. tax_document and bank_details were added by the forms migration to support starter-form uploads (P45, RTW, etc.)