This commit is contained in:
root
2026-09-14 20:51:40 +02:00
parent c3bf614901
commit 4195326938
4 changed files with 603 additions and 14 deletions
+26
View File
@@ -32,6 +32,14 @@ CREATE TABLE IF NOT EXISTS items (
position REAL NOT NULL DEFAULT 0,
sublist_id INTEGER REFERENCES sublists(id),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS recurring_items (
id INTEGER PRIMARY KEY AUTOINCREMENT,
list_id TEXT NOT NULL REFERENCES lists(id),
name TEXT NOT NULL,
sublist_id INTEGER REFERENCES sublists(id),
position REAL NOT NULL DEFAULT 0,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);`
const mysqlSchema = `
@@ -58,6 +66,16 @@ CREATE TABLE IF NOT EXISTS items (
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (list_id) REFERENCES lists(id),
FOREIGN KEY (sublist_id) REFERENCES sublists(id)
);
CREATE TABLE IF NOT EXISTS recurring_items (
id INTEGER PRIMARY KEY AUTO_INCREMENT,
list_id VARCHAR(64) NOT NULL,
name VARCHAR(255) NOT NULL,
sublist_id INTEGER,
position DOUBLE NOT NULL DEFAULT 0,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (list_id) REFERENCES lists(id),
FOREIGN KEY (sublist_id) REFERENCES sublists(id)
);`
const postgresSchema = `
@@ -81,6 +99,14 @@ CREATE TABLE IF NOT EXISTS items (
position DOUBLE PRECISION NOT NULL DEFAULT 0,
sublist_id INTEGER REFERENCES sublists(id),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS recurring_items (
id SERIAL PRIMARY KEY,
list_id TEXT NOT NULL REFERENCES lists(id),
name TEXT NOT NULL,
sublist_id INTEGER REFERENCES sublists(id),
position DOUBLE PRECISION NOT NULL DEFAULT 0,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);`
// querier is the subset of *sql.DB every handler uses. Postgres needs its own