Data Model & Storage
There is still an ongoing migration from FaunaDB to Superbase. Until now, FaunaDB is the main database.
Primary store: Postgres (Supabase) with Prisma
- Schema:
prisma/schema.prisma - Prisma client provided by
@power-rent/prisma-clientand consumed directly in services - Prisma client is always backed by Supabase; no stub implementation is used.
Legacy store: FaunaDB
- Access via
FaunaDBhelpers and fql in server resolvers/context - Migration flags allow entity-by-entity cutover
Access patterns:
- Tenant-aware services instantiated via
createTenantServices(services/index.ts) after auth middleware - Dataloaders:
server/graphql/helpers/dataloaderPostgres.jsandserver/graphql/helpers/dataloader.js
Initialization steps:
- Provision Postgres (Supabase) and set
SUPABASE_PRISMA_URL(+ non-pooling) - Run migrations and seed
# If migrations are in repoyarn prisma:generate# Apply migrations with Prisma CLI or Supabase migration processNotes:
- Row Level Security is expected on some tables per comments in schema; ensure policies in Supabase
- Date ranges use
tstzrangefor availability queries onorders