From 533ea85da9fdeaa8c899a096d0bfdb347c452609 Mon Sep 17 00:00:00 2001 From: Shish Date: Mon, 26 Oct 2020 23:30:52 +0000 Subject: [PATCH] boolinate locked --- core/install.php | 2 +- ext/upgrade/main.php | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/core/install.php b/core/install.php index 74bb3e72..c86cec6e 100644 --- a/core/install.php +++ b/core/install.php @@ -255,7 +255,7 @@ function create_tables(Database $db) width INTEGER NOT NULL, height INTEGER NOT NULL, posted TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - locked SCORE_BOOL NOT NULL DEFAULT SCORE_BOOL_N, + locked BOOLEAN NOT NULL DEFAULT FALSE, FOREIGN KEY (owner_id) REFERENCES users(id) ON DELETE RESTRICT "); $db->execute("CREATE INDEX images_owner_id_idx ON images(owner_id)", []); diff --git a/ext/upgrade/main.php b/ext/upgrade/main.php index bfdf8f3d..0afcca24 100644 --- a/ext/upgrade/main.php +++ b/ext/upgrade/main.php @@ -32,9 +32,9 @@ class Upgrade extends Extension // now done again as v9 with PDO if ($this->get_version("db_version") < 8) { - $database->execute($database->scoreql_to_sql( - "ALTER TABLE images ADD COLUMN locked SCORE_BOOL NOT NULL DEFAULT SCORE_BOOL_N" - )); + $database->execute( + "ALTER TABLE images ADD COLUMN locked BOOLEAN NOT NULL DEFAULT FALSE" + ); $this->set_version("db_version", 8); } @@ -197,6 +197,11 @@ class Upgrade extends Extension $this->set_version("db_version", 19); } + + if ($this->get_version("db_version") < 20) { + $database->standardise_boolean("images", "locked"); + $this->set_version("db_version", 20); + } } public function get_priority(): int