more database support
This commit is contained in:
parent
0ef8db8371
commit
e415bd3fca
7 changed files with 25 additions and 12 deletions
|
@ -32,8 +32,8 @@ class Blotter extends Extension {
|
|||
important SCORE_BOOL NOT NULL DEFAULT SCORE_BOOL_N
|
||||
");
|
||||
// Insert sample data:
|
||||
$database->execute("INSERT INTO blotter (id, entry_date, entry_text, important) VALUES (?, now(), ?, ?)",
|
||||
array(NULL, "Installed the blotter extension!", "Y"));
|
||||
$database->execute("INSERT INTO blotter (entry_date, entry_text, important) VALUES (now(), ?, ?)",
|
||||
array("Installed the blotter extension!", "Y"));
|
||||
log_info("blotter", "Installed tables for blotter extension.");
|
||||
$config->set_int("blotter_version", 1);
|
||||
}
|
||||
|
|
|
@ -120,9 +120,9 @@ class IPBan extends Extension {
|
|||
end_timestamp INTEGER,
|
||||
reason TEXT NOT NULL,
|
||||
added SCORE_DATETIME NOT NULL DEFAULT SCORE_NOW,
|
||||
INDEX (end_timestamp),
|
||||
FOREIGN KEY (banner_id) REFERENCES users(id) ON DELETE CASCADE,
|
||||
");
|
||||
$database->execute("CREATE INDEX bans__end_timestamp ON bans(end_timestamp)");
|
||||
$config->set_int("ext_ipban_version", 8);
|
||||
}
|
||||
|
||||
|
|
|
@ -61,10 +61,10 @@ class PrivMsg extends Extension {
|
|||
subject VARCHAR(64) NOT NULL,
|
||||
message TEXT NOT NULL,
|
||||
is_read SCORE_BOOL NOT NULL DEFAULT SCORE_BOOL_N,
|
||||
INDEX (to_id),
|
||||
FOREIGN KEY (from_id) REFERENCES users(id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (to_id) REFERENCES users(id) ON DELETE CASCADE
|
||||
");
|
||||
$database->execute("CREATE INDEX private_message__to_id ON private_message(to_id)");
|
||||
$config->set_int("pm_version", 2);
|
||||
log_info("pm", "extension installed");
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ class RatingSetEvent extends Event {
|
|||
}
|
||||
|
||||
class Ratings extends Extension {
|
||||
public $db_support = ['mysql']; // ?
|
||||
|
||||
/**
|
||||
* @return int
|
||||
|
|
|
@ -14,8 +14,9 @@ class Relationships extends Extension {
|
|||
|
||||
// Create the database tables
|
||||
if ($config->get_int("ext_relationships_version") < 1){
|
||||
$database->Execute("ALTER TABLE images ADD parent_id INT NULL, ADD INDEX (parent_id);");
|
||||
$database->Execute("ALTER TABLE images ADD has_children BOOL DEFAULT FALSE NOT NULL;");
|
||||
$database->execute("ALTER TABLE images ADD parent_id INT");
|
||||
$database->execute($database->scoreql_to_sql("ALTER TABLE images ADD has_children SCORE_BOOL DEFAULT SCORE_BOOL_N NOT NULL"));
|
||||
$database->execute("CREATE INDEX images__parent_id ON images(parent_id)");
|
||||
|
||||
$config->set_int("ext_relationships_version", 1);
|
||||
log_info("relationships", "extension installed");
|
||||
|
|
|
@ -18,9 +18,9 @@ class TagCategories extends Extension {
|
|||
// primary extension database, holds all our stuff!
|
||||
$database->create_table('image_tag_categories',
|
||||
'category VARCHAR(60) PRIMARY KEY,
|
||||
display_singular TEXT(60),
|
||||
display_multiple TEXT(60),
|
||||
color TEXT(7)');
|
||||
display_singular VARCHAR(60),
|
||||
display_multiple VARCHAR(60),
|
||||
color VARCHAR(7)');
|
||||
|
||||
$config->set_int("ext_tag_categories_version", 1);
|
||||
|
||||
|
@ -31,9 +31,18 @@ class TagCategories extends Extension {
|
|||
$number_of_db_rows = $database->execute('SELECT COUNT(*) FROM image_tag_categories;')->fetchColumn();
|
||||
|
||||
if ($number_of_db_rows == 0) {
|
||||
$database->execute('INSERT INTO image_tag_categories VALUES ("artist", "Artist", "Artists", "#BB6666");');
|
||||
$database->execute('INSERT INTO image_tag_categories VALUES ("series", "Series", "Series", "#AA00AA");');
|
||||
$database->execute('INSERT INTO image_tag_categories VALUES ("character", "Character", "Characters", "#66BB66");');
|
||||
$database->execute(
|
||||
'INSERT INTO image_tag_categories VALUES (?, ?, ?, ?)',
|
||||
array("artist", "Artist", "Artists", "#BB6666")
|
||||
);
|
||||
$database->execute(
|
||||
'INSERT INTO image_tag_categories VALUES (?, ?, ?, ?)',
|
||||
array("series", "Series", "Series", "#AA00AA")
|
||||
);
|
||||
$database->execute(
|
||||
'INSERT INTO image_tag_categories VALUES (?, ?, ?, ?)',
|
||||
array("character", "Character", "Characters", "#66BB66")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
*/
|
||||
|
||||
class Tips extends Extension {
|
||||
public $db_support = ['mysql', 'sqlite']; // rand() ?
|
||||
|
||||
public function onInitExt(InitExtEvent $event) {
|
||||
global $config, $database;
|
||||
|
||||
|
|
Reference in a new issue