From f491ed95a3bc82c31c70b0f38ed841408576ec0c Mon Sep 17 00:00:00 2001 From: WriterV2 Date: Sat, 21 Mar 2026 11:56:19 +0100 Subject: Purge + prepare for local website builder --- migrations/20241026164427_init.sql | 67 ---------------------- migrations/20241106161637_tagredesign.sql | 13 ----- migrations/20241124111952_uniquetags.sql | 19 ------ .../20251121124741_remove_story_epub_file.sql | 1 - 4 files changed, 100 deletions(-) delete mode 100644 migrations/20241026164427_init.sql delete mode 100644 migrations/20241106161637_tagredesign.sql delete mode 100644 migrations/20241124111952_uniquetags.sql delete mode 100644 migrations/20251121124741_remove_story_epub_file.sql (limited to 'migrations') diff --git a/migrations/20241026164427_init.sql b/migrations/20241026164427_init.sql deleted file mode 100644 index be6ffca..0000000 --- a/migrations/20241026164427_init.sql +++ /dev/null @@ -1,67 +0,0 @@ -CREATE TABLE IF NOT EXISTS product -( - id INTEGER PRIMARY KEY NOT NULL, - name TEXT NOT NULL UNIQUE, - description TEXT NOT NULL UNIQUE, - uploaddate INTEGER NOT NULL, - updatedate INTEGER NOT NULL -); - -CREATE TABLE IF NOT EXISTS story -( - id INTEGER PRIMARY KEY NOT NULL, - language TEXT NOT NULL, - pdf BLOB NOT NULL, - epub BLOB NOT NULL, - pid INTEGER NOT NULL, - FOREIGN KEY (pid) REFERENCES product(id) -); - -CREATE TABLE IF NOT EXISTS tool -( - id INTEGER PRIMARY KEY NOT NULL, - repolink TEXT NOT NULL, - pid INTEGER NOT NULL, - FOREIGN KEY (pid) REFERENCES product(id) -); - -CREATE TABLE IF NOT EXISTS game -( - id INTEGER PRIMARY KEY NOT NULL, - repolink TEXT NOT NULL, - pid INTEGER NOT NULL, - FOREIGN KEY (pid) REFERENCES product(id) -); - -CREATE TABLE IF NOT EXISTS tag -( - id INTEGER PRIMARY KEY NOT NULL, - name TEXT NOT NULL -); - -CREATE TABLE IF NOT EXISTS storytag -( - sid INTEGER NOT NULL, - tgid INTEGER NOT NULL, - FOREIGN KEY (sid) REFERENCES story(id), - FOREIGN KEY (tgid) REFERENCES tag(id), - PRIMARY KEY (sid, tgid) -); - -CREATE TABLE IF NOT EXISTS tooltag -( - tid INTEGER NOT NULL, - tgid INTEGER NOT NULL, - FOREIGN KEY (tid) REFERENCES tool(id), - FOREIGN KEY (tgid) REFERENCES tag(id), - PRIMARY KEY (tid, tgid) -); - -CREATE TABLE IF NOT EXISTS gametag -( - gid INTEGER NOT NULL, - tgid INTEGER NOT NULL, - FOREIGN KEY (gid) REFERENCES game(id), - FOREIGN KEY (tgid) REFERENCES tag(id), - PRIMARY KEY (gid, tgid) -); diff --git a/migrations/20241106161637_tagredesign.sql b/migrations/20241106161637_tagredesign.sql deleted file mode 100644 index c33cec3..0000000 --- a/migrations/20241106161637_tagredesign.sql +++ /dev/null @@ -1,13 +0,0 @@ -DROP TABLE IF EXISTS storytag; -DROP TABLE IF EXISTS gametag; -DROP TABLE IF EXISTS tooltag; - -CREATE TABLE IF NOT EXISTS producttag -( - pid INTEGER NOT NULL, - tid INTEGER NOT NULL, - FOREIGN KEY (pid) REFERENCES product(id), - FOREIGN KEY (tid) REFERENCES tag(id), - PRIMARY KEY (pid, tid) -); - diff --git a/migrations/20241124111952_uniquetags.sql b/migrations/20241124111952_uniquetags.sql deleted file mode 100644 index ff8b6ef..0000000 --- a/migrations/20241124111952_uniquetags.sql +++ /dev/null @@ -1,19 +0,0 @@ -DELETE FROM producttag; -CREATE TABLE IF NOT EXISTS newtag -( - id INTEGER PRIMARY KEY NOT NULL, - name TEXT NOT NULL UNIQUE -); - -WITH uniquetags AS ( - SELECT id, name, ROW_NUMBER() OVER (PARTITION BY name ORDER BY id) AS row_num - FROM tag -) - -INSERT INTO newtag (id, name) -SELECT id, name -FROM uniquetags -WHERE row_num = 1; - -DROP TABLE tag; -ALTER TABLE newtag RENAME TO tag; diff --git a/migrations/20251121124741_remove_story_epub_file.sql b/migrations/20251121124741_remove_story_epub_file.sql deleted file mode 100644 index 77dd00c..0000000 --- a/migrations/20251121124741_remove_story_epub_file.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE story DROP COLUMN epub; -- cgit v1.2.3