[pools] remove mysql-specific bits

This commit is contained in:
Shish 2023-08-18 22:23:40 +01:00 committed by Shish
parent 1cef09f39e
commit 867fdec284

View file

@ -135,9 +135,10 @@ class Pools extends Extension
id SCORE_AIPK, id SCORE_AIPK,
user_id INTEGER NOT NULL, user_id INTEGER NOT NULL,
public BOOLEAN NOT NULL DEFAULT FALSE, public BOOLEAN NOT NULL DEFAULT FALSE,
title VARCHAR(255) NOT NULL, title VARCHAR(255) NOT NULL UNIQUE,
description TEXT, description TEXT,
date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
lastupdated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
posts INTEGER NOT NULL DEFAULT 0, posts INTEGER NOT NULL DEFAULT 0,
FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE
"); ");
@ -164,12 +165,6 @@ class Pools extends Extension
log_info("pools", "extension installed"); log_info("pools", "extension installed");
} }
if ($this->get_version("ext_pools_version") < 2) {
$database->execute("ALTER TABLE pools ADD UNIQUE INDEX (title);");
$database->execute("ALTER TABLE pools ADD lastupdated TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;");
$this->set_version("ext_pools_version", 3); // skip 2
}
if ($this->get_version("ext_pools_version") < 4) { if ($this->get_version("ext_pools_version") < 4) {
$database->standardise_boolean("pools", "public"); $database->standardise_boolean("pools", "public");
$this->set_version("ext_pools_version", 4); $this->set_version("ext_pools_version", 4);
@ -403,7 +398,7 @@ class Pools extends Extension
case "edit_description": case "edit_description":
if ($this->have_permission($user, $pool)) { if ($this->have_permission($user, $pool)) {
$database->execute( $database->execute(
"UPDATE pools SET description=:dsc WHERE id=:pid", "UPDATE pools SET description=:dsc,lastupdated=CURRENT_TIMESTAMP WHERE id=:pid",
["dsc" => $_POST['description'], "pid" => $pool_id] ["dsc" => $_POST['description'], "pid" => $pool_id]
); );
$page->set_mode(PageMode::REDIRECT); $page->set_mode(PageMode::REDIRECT);
@ -983,7 +978,7 @@ class Pools extends Extension
{ {
global $database; global $database;
$database->execute( $database->execute(
"UPDATE pools SET posts=(SELECT COUNT(*) FROM pool_images WHERE pool_id=:pid) WHERE id=:pid", "UPDATE pools SET posts=(SELECT COUNT(*) FROM pool_images WHERE pool_id=:pid),lastupdated=CURRENT_TIMESTAMP WHERE id=:pid",
["pid" => $pool_id] ["pid" => $pool_id]
); );
} }