aboutsummaryrefslogtreecommitdiff
path: root/drizzle/0000_youthful_mercury.sql
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2026-07-27 18:31:26 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2026-07-27 18:31:26 +0200
commite14717b2e7853705469275d64023bb902b195ebb (patch)
tree2e450f7b4e864e232d06df43ad1aba1b62be4f4c /drizzle/0000_youthful_mercury.sql
parent8224c7d6572db6ec76c4224eec1df8a538b47ad4 (diff)
feat: separate categories table + /categories management page
- Categories table (id, name unique) with FK from groceries.category_id - /categories page for add/delete categories - Main page uses native <select> dropdown for category - Categories grouped by name in list/catalog views - Regenerated drizzle migrations from scratch
Diffstat (limited to 'drizzle/0000_youthful_mercury.sql')
-rw-r--r--drizzle/0000_youthful_mercury.sql16
1 files changed, 16 insertions, 0 deletions
diff --git a/drizzle/0000_youthful_mercury.sql b/drizzle/0000_youthful_mercury.sql
new file mode 100644
index 0000000..6dde7ff
--- /dev/null
+++ b/drizzle/0000_youthful_mercury.sql
@@ -0,0 +1,16 @@
+CREATE TABLE `categories` (
+ `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
+ `name` text NOT NULL
+);
+--> statement-breakpoint
+CREATE UNIQUE INDEX `categories_name_unique` ON `categories` (`name`);--> statement-breakpoint
+CREATE TABLE `groceries` (
+ `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
+ `name` text NOT NULL,
+ `checked` integer DEFAULT false NOT NULL,
+ `created_at` text NOT NULL,
+ `category_id` integer,
+ FOREIGN KEY (`category_id`) REFERENCES `categories`(`id`) ON UPDATE no action ON DELETE no action
+);
+--> statement-breakpoint
+CREATE UNIQUE INDEX `groceries_name_unique` ON `groceries` (`name`); \ No newline at end of file