Skip to content

Database Setup

Supabase Cloud (Production)

  1. Create a Supabase project at supabase.com
  2. 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
  1. Enable Realtime for required tables:
  2. Go to Database → Replication
  3. Ensure orders, notifications, messages are in the publication

  4. 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.prisma
  • pharmanet-web/prisma/schema.prisma

Changes should be made in both schemas and the migration SQL to stay in sync.