Skip to content

๐Ÿ—„๏ธ Database โ€‹

KitchenAsty uses PostgreSQL 16 with Prisma ORM for schema management, migrations, and queries.

๐Ÿ”Œ Connection โ€‹

Set the connection string in your .env:

dotenv
DATABASE_URL=postgresql://user:password@host:5432/kitchenasty

๐Ÿ“ Prisma Schema โ€‹

The schema lives at prisma/schema.prisma in the repository root. It defines 20+ models across domains like users, menu, orders, payments, reservations, and more.

See Database Schema for the full model reference.

๐Ÿ”„ Migrations โ€‹

๐Ÿ†• Generate a migration after schema changes โ€‹

bash
npx -w packages/server prisma migrate dev --schema ../../prisma/schema.prisma --name describe_your_change

๐Ÿš€ Deploy migrations in production โ€‹

bash
npx -w packages/server prisma migrate deploy --schema ../../prisma/schema.prisma

โšก Push schema without migrations (development) โ€‹

bash
npx -w packages/server prisma db push --schema ../../prisma/schema.prisma

๐ŸŒฑ Seeding โ€‹

The seed script at prisma/seed.ts creates:

  • ๐Ÿ‘ค A Super Admin user (admin@kitchenasty.com / admin123)
  • ๐Ÿ“ A sample location with operating hours
  • ๐Ÿฝ๏ธ Menu categories and items with options
  • ๐Ÿช‘ Tables for reservations
  • โš ๏ธ Sample allergens

Run the seed:

bash
npx tsx prisma/seed.ts

๐Ÿ” Prisma Studio โ€‹

Browse and edit data with the built-in GUI:

bash
npx -w packages/server prisma studio --schema ../../prisma/schema.prisma

Opens at http://localhost:5555.

๐Ÿ—‘๏ธ Reset โ€‹

Drop all data and re-run migrations + seed:

bash
npx -w packages/server prisma migrate reset --schema ../../prisma/schema.prisma

WARNING

This permanently deletes all data. Only use in development.