aboutsummaryrefslogtreecommitdiff
path: root/src/db/migrations/02-categories.sql
diff options
context:
space:
mode:
authorJoris2025-02-07 10:35:20 +0100
committerJoris2025-02-07 10:35:20 +0100
commit582c03eacbc73b851aa232c404be71b2cf77295a (patch)
tree59c48474f03135a7cdb8c104f372a84f1777cac8 /src/db/migrations/02-categories.sql
parent8a78d6fcb970d256f7645d6c0a6f02da987a2896 (diff)
Use strict mode for tables
Diffstat (limited to 'src/db/migrations/02-categories.sql')
-rw-r--r--src/db/migrations/02-categories.sql11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/db/migrations/02-categories.sql b/src/db/migrations/02-categories.sql
new file mode 100644
index 0000000..0b373d0
--- /dev/null
+++ b/src/db/migrations/02-categories.sql
@@ -0,0 +1,11 @@
+CREATE TABLE IF NOT EXISTS "categories" (
+ "id" TEXT PRIMARY KEY, /* UUID */
+ "name" TEXT NOT NULL UNIQUE,
+ "color" TEXT NOT NULL, /* COLOR */
+ "created" TEXT NOT NULL, /* DATETIME */
+ "updated" TEXT NOT NULL /* DATETIME */
+);
+
+ALTER TABLE "events" ADD COLUMN "category" TEXT REFERENCES "categories" ("id"); /* UUID */
+
+PRAGMA foreign_keys = ON