diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-07-27 18:31:26 +0200 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-07-27 18:31:26 +0200 |
| commit | e14717b2e7853705469275d64023bb902b195ebb (patch) | |
| tree | 2e450f7b4e864e232d06df43ad1aba1b62be4f4c /drizzle | |
| parent | 8224c7d6572db6ec76c4224eec1df8a538b47ad4 (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')
| -rw-r--r-- | drizzle/0000_known_scarecrow.sql | 6 | ||||
| -rw-r--r-- | drizzle/0000_youthful_mercury.sql | 16 | ||||
| -rw-r--r-- | drizzle/0001_dear_bastion.sql | 1 | ||||
| -rw-r--r-- | drizzle/meta/0000_snapshot.json | 59 | ||||
| -rw-r--r-- | drizzle/meta/0001_snapshot.json | 63 | ||||
| -rw-r--r-- | drizzle/meta/_journal.json | 11 |
6 files changed, 74 insertions, 82 deletions
diff --git a/drizzle/0000_known_scarecrow.sql b/drizzle/0000_known_scarecrow.sql deleted file mode 100644 index 7d70133..0000000 --- a/drizzle/0000_known_scarecrow.sql +++ /dev/null @@ -1,6 +0,0 @@ -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 -); 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 diff --git a/drizzle/0001_dear_bastion.sql b/drizzle/0001_dear_bastion.sql deleted file mode 100644 index ecc896d..0000000 --- a/drizzle/0001_dear_bastion.sql +++ /dev/null @@ -1 +0,0 @@ -CREATE UNIQUE INDEX `groceries_name_unique` ON `groceries` (`name`);
\ No newline at end of file diff --git a/drizzle/meta/0000_snapshot.json b/drizzle/meta/0000_snapshot.json index 99fa112..6e33354 100644 --- a/drizzle/meta/0000_snapshot.json +++ b/drizzle/meta/0000_snapshot.json @@ -1,9 +1,39 @@ { "version": "6", "dialect": "sqlite", - "id": "265bc06f-5de9-43a2-9427-39ce061f134c", + "id": "54c7ae45-9838-4ffb-ad46-29995def7272", "prevId": "00000000-0000-0000-0000-000000000000", "tables": { + "categories": { + "name": "categories", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "categories_name_unique": { + "name": "categories_name_unique", + "columns": ["name"], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, "groceries": { "name": "groceries", "columns": { @@ -35,10 +65,33 @@ "primaryKey": false, "notNull": true, "autoincrement": false + }, + "category_id": { + "name": "category_id", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "groceries_name_unique": { + "name": "groceries_name_unique", + "columns": ["name"], + "isUnique": true + } + }, + "foreignKeys": { + "groceries_category_id_categories_id_fk": { + "name": "groceries_category_id_categories_id_fk", + "tableFrom": "groceries", + "tableTo": "categories", + "columnsFrom": ["category_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" } }, - "indexes": {}, - "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} diff --git a/drizzle/meta/0001_snapshot.json b/drizzle/meta/0001_snapshot.json deleted file mode 100644 index 92fe548..0000000 --- a/drizzle/meta/0001_snapshot.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "version": "6", - "dialect": "sqlite", - "id": "b20afe62-9a50-42b6-bb34-1be35863e817", - "prevId": "265bc06f-5de9-43a2-9427-39ce061f134c", - "tables": { - "groceries": { - "name": "groceries", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "autoincrement": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "checked": { - "name": "checked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "groceries_name_unique": { - "name": "groceries_name_unique", - "columns": ["name"], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - } - }, - "views": {}, - "enums": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - }, - "internal": { - "indexes": {} - } -} diff --git a/drizzle/meta/_journal.json b/drizzle/meta/_journal.json index 7e6fb0d..2923632 100644 --- a/drizzle/meta/_journal.json +++ b/drizzle/meta/_journal.json @@ -5,15 +5,8 @@ { "idx": 0, "version": "6", - "when": 1785163537728, - "tag": "0000_known_scarecrow", - "breakpoints": true - }, - { - "idx": 1, - "version": "6", - "when": 1785165400399, - "tag": "0001_dear_bastion", + "when": 1785169427572, + "tag": "0000_youthful_mercury", "breakpoints": true } ] |
