aboutsummaryrefslogtreecommitdiff
path: root/src/lib/server/db/schema.ts
blob: 1d5fd9e225e54a77105851fc23d90a9c974d2f07 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14

import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core';

export const categories = sqliteTable('categories', {
	id: integer('id').primaryKey({ autoIncrement: true }),
	name: text('name').notNull().unique(),
});

export const groceries = sqliteTable('groceries', {
	id: integer('id').primaryKey({ autoIncrement: true }),
	name: text('name').notNull().unique(),
	checked: integer('checked', { mode: 'boolean' }).notNull().default(false),
	createdAt: text('created_at').notNull(),
	categoryId: integer('category_id').references(() => categories.id),
});