From 72a59ce7a481448e61427de66c9f82e82b3a2c3c Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Mon, 27 Dec 2021 18:54:48 +0800 Subject: [PATCH] add status page table --- db/patch-status-page.sql | 25 +++++++++++++++++++++++++ server/database.js | 1 + 2 files changed, 26 insertions(+) create mode 100644 db/patch-status-page.sql diff --git a/db/patch-status-page.sql b/db/patch-status-page.sql new file mode 100644 index 00000000..18986403 --- /dev/null +++ b/db/patch-status-page.sql @@ -0,0 +1,25 @@ +-- You should not modify if this have pushed to Github, unless it does serious wrong with the db. +BEGIN TRANSACTION; + +CREATE TABLE [status_page]( + [id] INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, + [slug] VARCHAR(255) NOT NULL UNIQUE, + [title] VARCHAR(255) NOT NULL, + [icon] VARCHAR(255) NOT NULL, + [theme] VARCHAR(30) NOT NULL, + [published] BOOLEAN NOT NULL DEFAULT 1, + [search_engine_index] BOOLEAN NOT NULL DEFAULT 1, + [public] BOOLEAN NOT NULL DEFAULT 1, + [password] VARCHAR +); + +CREATE UNIQUE INDEX [slug] ON [status_page]([slug]); + + +CREATE TABLE [status_page_cname]( + [id] INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, + [status_page_id] INTEGER NOT NULL REFERENCES [status_page]([id]) ON DELETE CASCADE ON UPDATE CASCADE, + [domain] VARCHAR NOT NULL UNIQUE +); + +COMMIT; diff --git a/server/database.js b/server/database.js index afcace70..fcef9171 100644 --- a/server/database.js +++ b/server/database.js @@ -53,6 +53,7 @@ class Database { "patch-2fa-invalidate-used-token.sql": true, "patch-notification_sent_history.sql": true, "patch-monitor-basic-auth.sql": true, + "patch-status-page.sql": true, } /**