diff options
author | Joris | 2022-04-24 16:31:49 +0200 |
---|---|---|
committer | Joris | 2022-04-24 16:31:49 +0200 |
commit | 47fe90ee23d8ab04645ef3c7a17459ed40c5b765 (patch) | |
tree | d1aa7d3840a3bd825dcae0a0398fec7ca310f45c /src/db/migrations | |
parent | 6d271b09303d924381cc65e7c0b5eb56833780ed (diff) |
Allow to attach categories to events
Diffstat (limited to 'src/db/migrations')
-rw-r--r-- | src/db/migrations/2-categories.sql | 10 | ||||
-rw-r--r-- | src/db/migrations/3-event-color.sql | 5 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/db/migrations/2-categories.sql b/src/db/migrations/2-categories.sql index 27e9699..0b373d0 100644 --- a/src/db/migrations/2-categories.sql +++ b/src/db/migrations/2-categories.sql @@ -1,13 +1,11 @@ CREATE TABLE IF NOT EXISTS "categories" ( "id" TEXT PRIMARY KEY, /* UUID */ - "name" TEXT NOT NULL, - "color" TEXT NOT NULL, /* HEXA */ + "name" TEXT NOT NULL UNIQUE, + "color" TEXT NOT NULL, /* COLOR */ "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 */ + +PRAGMA foreign_keys = ON diff --git a/src/db/migrations/3-event-color.sql b/src/db/migrations/3-event-color.sql new file mode 100644 index 0000000..ec589ea --- /dev/null +++ b/src/db/migrations/3-event-color.sql @@ -0,0 +1,5 @@ +CREATE TABLE IF NOT EXISTS "event_color" ( + "color" TEXT NOT NULL /* COLOR */ +); + +INSERT INTO "event_color" ("color") VALUES ("#a8c2e0"); |