From 6d271b09303d924381cc65e7c0b5eb56833780ed Mon Sep 17 00:00:00 2001 From: Joris Date: Sat, 23 Apr 2022 16:27:00 +0200 Subject: Create categories table --- src/db/migrations/2-categories.sql | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/db/migrations/2-categories.sql (limited to 'src/db/migrations') diff --git a/src/db/migrations/2-categories.sql b/src/db/migrations/2-categories.sql new file mode 100644 index 0000000..27e9699 --- /dev/null +++ b/src/db/migrations/2-categories.sql @@ -0,0 +1,13 @@ +CREATE TABLE IF NOT EXISTS "categories" ( + "id" TEXT PRIMARY KEY, /* UUID */ + "name" TEXT NOT NULL, + "color" TEXT NOT NULL, /* HEXA */ + "created" TEXT NOT NULL, /* DATETIME */ + "updated" TEXT NOT NULL /* DATETIME */ +); + +INSERT INTO + "categories" ("id", "name", "color", "created", "updated") + VALUES ("b2253284-1572-43d5-96ec-bf6ad448f46a", "Perso", "#a8c2e0", datetime(), datetime()); + +ALTER TABLE "events" ADD COLUMN "category" TEXT REFERENCES "categories" ("id"); /* UUID */ -- cgit v1.2.3