compatibility with out-of-date sqlite: use '(1=0)' instead of 'false'
This commit is contained in:
parent
e6e9d6db1c
commit
55e3cb5d63
11 changed files with 23 additions and 23 deletions
|
@ -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 FALSE NOT NULL");
|
||||
$this->execute("ALTER TABLE $table ADD COLUMN ${column}_b BOOLEAN DEFAULT (1=0) 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");
|
||||
|
|
|
@ -456,11 +456,11 @@ class Image
|
|||
"id" => $this->id,
|
||||
"width" => $this->width ?? 0,
|
||||
"height" => $this->height ?? 0,
|
||||
"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),
|
||||
"lossless" => $this->lossless,
|
||||
"video" => $this->video,
|
||||
"video_codec" => $this->video_codec,
|
||||
"image" => $this->image,
|
||||
"audio" => $this->audio,
|
||||
"length" => $this->length
|
||||
]
|
||||
);
|
||||
|
|
|
@ -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 FALSE
|
||||
important BOOLEAN NOT NULL DEFAULT (1=0)
|
||||
");
|
||||
// Insert sample data:
|
||||
$database->execute(
|
||||
|
|
|
@ -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 FALSE,
|
||||
sticky BOOLEAN NOT NULL DEFAULT (1=0),
|
||||
title VARCHAR(255) NOT NULL,
|
||||
user_id INTEGER NOT NULL,
|
||||
date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
|
|
@ -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 FALSE,
|
||||
is_read BOOLEAN NOT NULL DEFAULT (1=0),
|
||||
FOREIGN KEY (from_id) REFERENCES users(id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (to_id) REFERENCES users(id) ON DELETE CASCADE
|
||||
");
|
||||
|
|
|
@ -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 FALSE,
|
||||
public BOOLEAN NOT NULL DEFAULT (1=0),
|
||||
title VARCHAR(255) NOT NULL,
|
||||
description TEXT,
|
||||
date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
|
|
@ -133,13 +133,13 @@ class PrivateImage extends Extension
|
|||
if ($show_private) {
|
||||
$event->add_querylet(
|
||||
new Querylet(
|
||||
"private != :true OR owner_id = :private_owner_id",
|
||||
["private_owner_id"=>$user->id, "true"=>true]
|
||||
"private = :false OR owner_id = :private_owner_id",
|
||||
["private_owner_id"=>$user->id, "false"=>false]
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$event->add_querylet(
|
||||
new Querylet("private != :true", ["true"=>true])
|
||||
new Querylet("private = :false", ["false"=>false])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -153,8 +153,8 @@ class PrivateImage extends Extension
|
|||
$query = "";
|
||||
switch ($matches[1]) {
|
||||
case "no":
|
||||
$query .= "private != :true";
|
||||
$params["true"] = true;
|
||||
$query .= "private = :false";
|
||||
$params["false"] = false;
|
||||
break;
|
||||
case "yes":
|
||||
$query .= "private = :true";
|
||||
|
@ -168,8 +168,8 @@ class PrivateImage extends Extension
|
|||
}
|
||||
break;
|
||||
case "any":
|
||||
$query .= "private != :true OR owner_id = :private_owner_id";
|
||||
$params["true"] = true;
|
||||
$query .= "private = :false OR owner_id = :private_owner_id";
|
||||
$params["false"] = false;
|
||||
$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 FALSE");
|
||||
$database->execute("ALTER TABLE images ADD COLUMN private BOOLEAN NOT NULL DEFAULT (1=0)");
|
||||
$database->execute("CREATE INDEX images_private_idx ON images(private)");
|
||||
$this->set_version(PrivateImageConfig::VERSION, 2);
|
||||
}
|
||||
|
|
|
@ -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 FALSE NOT NULL");
|
||||
$database->execute("ALTER TABLE images ADD has_children BOOLEAN DEFAULT (1=0) 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);
|
||||
|
|
|
@ -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 FALSE,
|
||||
enable BOOLEAN NOT NULL DEFAULT (1=0),
|
||||
image TEXT NOT NULL,
|
||||
text TEXT NOT NULL,
|
||||
");
|
||||
|
|
|
@ -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 != :true", ["true"=>true]));
|
||||
$event->add_querylet(new Querylet("trash = :false", ["false"=>false]));
|
||||
}
|
||||
|
||||
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 FALSE");
|
||||
$database->execute("ALTER TABLE images ADD COLUMN trash BOOLEAN NOT NULL DEFAULT (1=0)");
|
||||
$database->execute("CREATE INDEX images_trash_idx ON images(trash)");
|
||||
$this->set_version(TrashConfig::VERSION, 2);
|
||||
}
|
||||
|
|
|
@ -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 FALSE,
|
||||
locked BOOLEAN NOT NULL DEFAULT (1=0),
|
||||
body TEXT NOT NULL,
|
||||
UNIQUE (title, revision),
|
||||
FOREIGN KEY (owner_id) REFERENCES users(id) ON DELETE RESTRICT
|
||||
|
|
Reference in a new issue