Database Setup¶
Supabase Cloud (Production)¶
- Create a Supabase project at supabase.com
- Run the migration SQL:
# Option A: Supabase SQL Editor
# Open Dashboard → SQL Editor → paste supabase_complete_migration.sql
# Option B: psql
psql "$SUPABASE_DB_URL" -f supabase_complete_migration.sql
- Enable Realtime for required tables:
- Go to Database → Replication
-
Ensure
orders,notifications,messagesare in the publication -
Run Prisma migrations for web apps:
cd pharmanet-admin
npx prisma generate
npx prisma db push
cd pharmanet-web
npx prisma generate
npx prisma db push
Supabase Local (Development)¶
# Start local Supabase
supabase start
# Get local credentials
supabase status
# Run migration
psql "postgresql://postgres:postgres@localhost:54322/postgres" \
-f supabase_complete_migration.sql
Prisma Schema Location¶
Both web apps maintain their Prisma schema at:
pharmanet-admin/prisma/schema.prismapharmanet-web/prisma/schema.prisma
Changes should be made in both schemas and the migration SQL to stay in sync.
Related¶
- Schema — Complete table reference
- Migrations — Migration file index
- Local Setup — Environment variables