This commit is contained in:
@@ -56,3 +56,26 @@ CREATE TABLE IF NOT EXISTS admins (
|
||||
password_hash TEXT NOT NULL,
|
||||
created_at TEXT NOT NULL DEFAULT (datetime('now','+8 hours'))
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS four_hour_exports (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
status TEXT NOT NULL DEFAULT 'active',
|
||||
admin_username TEXT,
|
||||
eligible_count INTEGER NOT NULL DEFAULT 0,
|
||||
eligible_hours_total REAL NOT NULL DEFAULT 0,
|
||||
items_updated INTEGER NOT NULL DEFAULT 0,
|
||||
plan_json TEXT,
|
||||
note TEXT,
|
||||
created_at TEXT NOT NULL DEFAULT (datetime('now','+8 hours')),
|
||||
voided_at TEXT
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS four_hour_export_items (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
export_id INTEGER NOT NULL,
|
||||
hour_id INTEGER NOT NULL,
|
||||
delta REAL NOT NULL,
|
||||
FOREIGN KEY (export_id) REFERENCES four_hour_exports(id) ON DELETE CASCADE
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS idx_fhe_items_export ON four_hour_export_items(export_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_fhe_items_hour ON four_hour_export_items(hour_id);
|
||||
|
||||
Reference in New Issue
Block a user