๐๏ธ 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.prismaOpens at http://localhost:5555.
๐๏ธ Reset โ
Drop all data and re-run migrations + seed:
bash
npx -w packages/server prisma migrate reset --schema ../../prisma/schema.prismaWARNING
This permanently deletes all data. Only use in development.