Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

Database

This folder contains PostgreSQL migration scripts for the midemail platform.

Migration order

  1. 20260223130001_init.sql - extensions and migration tracking table
  2. 20260223130002_tenants_api_keys.sql - core identity + multitenancy + API key tables (users, organizations, members, invites, tenants, api_keys, oauth/refresh)
  3. 20260223130003_messages_jobs_outbox.sql - messages, recipients, durable jobs, outbox events
  4. 20260223130004_webhooks.sql - webhook endpoints, events, and delivery tracking
  5. 20260223130005_orchestrator.sql - orchestrator node heartbeat and lease tables
  6. 20260223130006_support_tables.sql - job events, generic leases, sender/receiver pools
  7. 20260223150008_smtp_domains_mailboxes.sql - mail domains, mailboxes, smtp credential auth tables
  8. 20260223160009_imap_core.sql - imap credentials, folders, and mailbox message store
  9. 20260223170010_push_notifications.sql - push devices, notifications, and provider delivery logs (FCM/APNs)
  10. 20260223180011_org_resources.sql - org API keys and org webhooks for API-key-based provisioning

Migrations are forward-only and timestamped (Supabase style).

Notes

  • API keys are stored as key_hash + key_prefix (never store raw keys).
  • SMTP mailbox credentials are stored as SHA-256 password_hash values in mailbox_smtp_credentials.
  • Queue execution is intended for Redis Streams; job_requests and outbox_events are the durable source of truth.
  • Webhook retries should be driven by webhook_deliveries.next_attempt_at and status.