From 613f0c161629dd1e05860d8289a4e01300c34dab Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Tue, 9 May 2023 21:27:52 +0400 Subject: [PATCH] PRIMARY KEY moved out on a separate line. Use INTEGER (Unix time) for created dates to save space. --- database/sqlite/queries/schema.sql | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/database/sqlite/queries/schema.sql b/database/sqlite/queries/schema.sql index 09ffb26..abad9a7 100644 --- a/database/sqlite/queries/schema.sql +++ b/database/sqlite/queries/schema.sql @@ -1,19 +1,21 @@ -- SQLite3 CREATE TABLE IF NOT EXISTS `entry` ( - `entry_id` INTEGER PRIMARY KEY NOT NULL, - `created` TEXT NOT NULL, + `entry_id` INTEGER NOT NULL, + `created` INTEGER NOT NULL, `name` TEXT NOT NULL, `message` TEXT NOT NULL, `website` TEXT NOT NULL, - `hide_website` INTEGER NOT NULL DEFAULT TRUE); + `hide_website` INTEGER NOT NULL DEFAULT TRUE, + PRIMARY KEY (`entry_id`) ); CREATE INDEX IF NOT EXISTS `entry_created_idx` ON `entry` (`created`); CREATE TABLE IF NOT EXISTS `reply` ( - `entry_id` INTEGER PRIMARY KEY NOT NULL, - `created` TEXT NOT NULL, + `entry_id` INTEGER NOT NULL, + `created` INTEGER NOT NULL, `message` TEXT NOT NULL, + PRIMARY KEY (`entry_id`), FOREIGN KEY (`entry_id`) REFERENCES `entry` (`entry_id`) ON DELETE CASCADE