🎉 initial commit

This commit is contained in:
Lukas Harat
2026-08-15 12:50:22 +02:00
commit cd04ebe254
31 changed files with 5423 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
import { integer, pgTable, serial, text, timestamp, unique } from 'drizzle-orm/pg-core'
export const restaurantTables = pgTable('restaurant_tables', {
id: serial('id').primaryKey(),
name: text('name').notNull(),
seats: integer('seats').notNull(),
})
export const reservations = pgTable(
'reservations',
{
id: serial('id').primaryKey(),
tableId: integer('table_id')
.notNull()
.references(() => restaurantTables.id, { onDelete: 'cascade' }),
customerName: text('customer_name').notNull(),
customerEmail: text('customer_email').notNull(),
partySize: integer('party_size').notNull(),
reservationTime: timestamp('reservation_time', { withTimezone: true }).notNull(),
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
},
(table) => [unique().on(table.tableId, table.reservationTime)],
)
export type RestaurantTable = typeof restaurantTables.$inferSelect
export type Reservation = typeof reservations.$inferSelect
export type NewReservation = typeof reservations.$inferInsert