Data Model & Storage
There is still an ongoing migration from FaunaDB to Postgres. Until now, FaunaDB is the main database.
Primary store: Postgres (Neon) with Prisma
- Schema:
prisma/schema.prisma - Prisma client provided by
@power-rent/prisma-clientand consumed directly in services - Prisma client is always backed by Neon Postgres; 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 (Neon) and set
ROOT_POSTGRES_URL(+ROOT_POSTGRES_URL_NON_POOLING) - Run migrations and seed
# If migrations are in repoyarn prisma:generate# Apply migrations with Prisma CLINotes:
- Date ranges use
tstzrangefor availability queries onorders