Database Schema Overview
Summary of the PostgreSQL schema used by Kesles Merchant. DDL details are in merchant_database/<db_name>/migrations/v1/.
For the list of VIEWs (regular & materialized) per consumer tier
- naming convention + migration checklist, see
database/schema/views.md.
Last updated: 2026-06-23 — legacy psp.*/sales_orders/purchasing/inventory tables DROPPED from main DB (mig 086-101); merchants.tid DROPPED (mig 104); integration, sandbox, document schemas added (mig 107-109); notification DB split into per-service schemas whatsapp/email/firebase (mig 010-012). db_kesles_merchant at v1/112.
Database Topology
| Database | Status | Owner Service | Migrations |
|---|---|---|---|
db_kesles_merchant | 🟢 LIVE — runtime utama | merchant_core_api | v1/112 |
db_kesles_merchant_auth | 🟢 LIVE — extraction COMPLETE 2026-05-30 | auth_service (port 8081) | v1/012 |
db_kesles_merchant_order | 🟢 LIVE | order_service (port 8083) | v1/009 |
db_kesles_merchant_payment | 🟢 LIVE | payment_service (port 8085) | v1/008 |
db_kesles_merchant_inventory | 🟢 LIVE | inventory_service (port 8084) | v1/016 |
db_kesles_merchant_partner | 🟢 LIVE | partner_service (port 8086) | v1/006 |
db_kesles_merchant_marketing | 🟢 LIVE — extraction Phase 9 COMPLETE 2026-05-29 | marketing_service (port 8095) | v1/002 |
db_kesles_merchant_content | 🟢 LIVE | content_service (port 8090) | v1/001 |
db_kesles_merchant_notification | 🟢 LIVE — cutover 2026-05-26 | whatsapp_service, email_service, firebase_service | v1/012 |
db_reference | 🟢 LIVE — master data | shared (read-only oleh semua service) | 61 SQL files |
Cross-DB FK policy: tidak ada FK constraint antar database. Relasi lintas DB disimpan sebagai plain UUID kolom biasa, divalidasi di app layer. Lihat comment
cross-DB UUID →pada DDL.
Schema Per Database
db_kesles_merchant — Runtime Utama
Catatan penting: schema iam, auth, kyc, notification, content, marketing sudah KOSONG total — semua tabel telah di-DROP dan dipindah ke DB masing-masing. Schema shell mungkin masih ada tetapi tidak ada tabel.
| Schema | Owner Service | Status |
|---|---|---|
merchant | merchant_core_api | AKTIF — merchants, outlets, terminals, registration |
psp | dashboard_api | AKTIF — hanya tersisa outbound_requests + merchant_psp_pairings + view v_active_merchants. api_keys/event_log DROPPED (mig 087-088), view device DROPPED (mig 101). Sole SOT db_kesles_merchant_payment.psp.*. |
integration | integration_api / dashboard_api | AKTIF — merchant_accounts, merchant_sandbox_access (mig 107-108) |
sandbox | integration_api | AKTIF — transactions, webhook log (mig 108) |
document | merchant_core_api | AKTIF — signers + jenis dokumen → penandatangan (mig 109) |
fraud | merchant_core_api | AKTIF — fraud signal, baseline, ML feature vector (mig 080-082, 2026-06-05) |
legal | auth_service | AKTIF — legal documents (pindah dari iam via mig 060) |
report | merchant_core_api |