Lewati ke konten

Database & RLS

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).
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_orders

Drizzle Kit V3 memakai format folder per-migration:

migrations/generated/<timestamp>_<name>/migration.sql
migrations/generated/<timestamp>_<name>/snapshot.json

Generate migration baru:

Terminal window
yarn workspace @treonstudio/klola-api db:generate

Terapkan:

Terminal window
yarn workspace @treonstudio/klola-api db:migrate