Argh, that doesn't work for OTHER versions of sqlite...

This reverts commit 55e3cb5d63.
This commit is contained in:
Shish 2020-10-26 22:37:25 +00:00
parent 55e3cb5d63
commit cc06df171a
11 changed files with 23 additions and 23 deletions

View file

@ -374,7 +374,7 @@ class Database
$this->execute("UPDATE $table SET $column = ($column IN ('Y', 1))");
}
if ($d == DatabaseDriver::PGSQL) {
$this->execute("ALTER TABLE $table ADD COLUMN ${column}_b BOOLEAN DEFAULT (1=0) NOT NULL");
$this->execute("ALTER TABLE $table ADD COLUMN ${column}_b BOOLEAN DEFAULT FALSE NOT NULL");
$this->execute("UPDATE $table SET ${column}_b = ($column = 'Y')");
$this->execute("ALTER TABLE $table DROP COLUMN $column");
$this->execute("ALTER TABLE $table RENAME COLUMN ${column}_b TO $column");

View file

@ -456,11 +456,11 @@ class Image
"id" => $this->id,
"width" => $this->width ?? 0,
"height" => $this->height ?? 0,
"lossless" => $this->lossless,
"video" => $this->video,
"video_codec" => $this->video_codec,
"image" => $this->image,
"audio" => $this->audio,
"lossless" => $database->scoresql_value_prepare($this->lossless),
"video" => $database->scoresql_value_prepare($this->video),
"video_codec" => $database->scoresql_value_prepare($this->video_codec),
"image" => $database->scoresql_value_prepare($this->image),
"audio" => $database->scoresql_value_prepare($this->audio),
"length" => $this->length
]
);

View file

@ -22,7 +22,7 @@ class Blotter extends Extension
id SCORE_AIPK,
entry_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
entry_text TEXT NOT NULL,
important BOOLEAN NOT NULL DEFAULT (1=0)
important BOOLEAN NOT NULL DEFAULT FALSE
");
// Insert sample data:
$database->execute(

View file

@ -21,7 +21,7 @@ class Forum extends Extension
if ($config->get_int("forum_version") < 1) {
$database->create_table("forum_threads", "
id SCORE_AIPK,
sticky BOOLEAN NOT NULL DEFAULT (1=0),
sticky BOOLEAN NOT NULL DEFAULT FALSE,
title VARCHAR(255) NOT NULL,
user_id INTEGER NOT NULL,
date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,

View file

@ -74,7 +74,7 @@ class PrivMsg extends Extension
sent_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
subject VARCHAR(64) NOT NULL,
message TEXT NOT NULL,
is_read BOOLEAN NOT NULL DEFAULT (1=0),
is_read BOOLEAN NOT NULL DEFAULT FALSE,
FOREIGN KEY (from_id) REFERENCES users(id) ON DELETE CASCADE,
FOREIGN KEY (to_id) REFERENCES users(id) ON DELETE CASCADE
");

View file

@ -132,7 +132,7 @@ class Pools extends Extension
$database->create_table("pools", "
id SCORE_AIPK,
user_id INTEGER NOT NULL,
public BOOLEAN NOT NULL DEFAULT (1=0),
public BOOLEAN NOT NULL DEFAULT FALSE,
title VARCHAR(255) NOT NULL,
description TEXT,
date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,

View file

@ -133,13 +133,13 @@ class PrivateImage extends Extension
if ($show_private) {
$event->add_querylet(
new Querylet(
"private = :false OR owner_id = :private_owner_id",
["private_owner_id"=>$user->id, "false"=>false]
"private != :true OR owner_id = :private_owner_id",
["private_owner_id"=>$user->id, "true"=>true]
)
);
} else {
$event->add_querylet(
new Querylet("private = :false", ["false"=>false])
new Querylet("private != :true", ["true"=>true])
);
}
}
@ -153,8 +153,8 @@ class PrivateImage extends Extension
$query = "";
switch ($matches[1]) {
case "no":
$query .= "private = :false";
$params["false"] = false;
$query .= "private != :true";
$params["true"] = true;
break;
case "yes":
$query .= "private = :true";
@ -168,8 +168,8 @@ class PrivateImage extends Extension
}
break;
case "any":
$query .= "private = :false OR owner_id = :private_owner_id";
$params["false"] = false;
$query .= "private != :true OR owner_id = :private_owner_id";
$params["true"] = true;
$params["private_owner_id"] = $user->id;
break;
}
@ -280,7 +280,7 @@ class PrivateImage extends Extension
global $database;
if ($this->get_version(PrivateImageConfig::VERSION) < 1) {
$database->execute("ALTER TABLE images ADD COLUMN private BOOLEAN NOT NULL DEFAULT (1=0)");
$database->execute("ALTER TABLE images ADD COLUMN private BOOLEAN NOT NULL DEFAULT FALSE");
$database->execute("CREATE INDEX images_private_idx ON images(private)");
$this->set_version(PrivateImageConfig::VERSION, 2);
}

View file

@ -33,7 +33,7 @@ class Relationships extends Extension
if ($this->get_version("ext_relationships_version") < 1) {
$database->execute("ALTER TABLE images ADD parent_id INT");
$database->execute("ALTER TABLE images ADD has_children BOOLEAN DEFAULT (1=0) NOT NULL");
$database->execute("ALTER TABLE images ADD has_children BOOLEAN DEFAULT FALSE NOT NULL");
$database->execute("CREATE INDEX images__parent_id ON images(parent_id)");
$database->execute("CREATE INDEX images__has_children ON images(has_children)");
$this->set_version("ext_relationships_version", 3);

View file

@ -36,7 +36,7 @@ class Tips extends Extension
if ($this->get_version("ext_tips_version") < 1) {
$database->create_table("tips", "
id SCORE_AIPK,
enable BOOLEAN NOT NULL DEFAULT (1=0),
enable BOOLEAN NOT NULL DEFAULT FALSE,
image TEXT NOT NULL,
text TEXT NOT NULL,
");

View file

@ -97,7 +97,7 @@ class Trash extends Extension
$matches = [];
if (is_null($event->term) && $this->no_trash_query($event->context)) {
$event->add_querylet(new Querylet("trash = :false", ["false"=>false]));
$event->add_querylet(new Querylet("trash != :true", ["true"=>true]));
}
if (is_null($event->term)) {
@ -182,7 +182,7 @@ class Trash extends Extension
global $database;
if ($this->get_version(TrashConfig::VERSION) < 1) {
$database->execute("ALTER TABLE images ADD COLUMN trash BOOLEAN NOT NULL DEFAULT (1=0)");
$database->execute("ALTER TABLE images ADD COLUMN trash BOOLEAN NOT NULL DEFAULT FALSE");
$database->execute("CREATE INDEX images_trash_idx ON images(trash)");
$this->set_version(TrashConfig::VERSION, 2);
}

View file

@ -133,7 +133,7 @@ class Wiki extends Extension
date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
title VARCHAR(255) NOT NULL,
revision INTEGER NOT NULL DEFAULT 1,
locked BOOLEAN NOT NULL DEFAULT (1=0),
locked BOOLEAN NOT NULL DEFAULT FALSE,
body TEXT NOT NULL,
UNIQUE (title, revision),
FOREIGN KEY (owner_id) REFERENCES users(id) ON DELETE RESTRICT