Database & RLS
Koneksi
Section titled “Koneksi”| Aspek | Nilai |
|---|---|
| Connection | Neon serverless (HTTP driver) |
| ORM | Drizzle ORM |
| Migrations | 94 applied (drizzle-kit V3 format) |
| RLS | Row-Level Security dengan app.current_tenant per-tenant |
| Isolation policies | 334+ tenant isolation policies |
Dua role database:
klola_app— request principal, semua query berjalan dengan scope RLS tenant.klola_worker— cross-tenant scheduled runtime (cron, outbox scheduler).
Tabel utama (146 total)
Section titled “Tabel utama (146 total)”businesses, branches, products, product_variants,product_batches, stock_movements, stock_per_branch,orders, order_items, order_payments,payments, payment_events,journal_entries, journal_entry_lines, chart_of_accounts,laundry_jobs, otp_challenges, cash_register_shifts,promo_codes, loyalty_config, suppliers, purchase_ordersMigrations
Section titled “Migrations”Drizzle Kit V3 memakai format folder per-migration:
migrations/generated/<timestamp>_<name>/migration.sqlmigrations/generated/<timestamp>_<name>/snapshot.jsonGenerate migration baru:
yarn workspace @treonstudio/klola-api db:generateTerapkan:
yarn workspace @treonstudio/klola-api db:migrate