defaults
This commit is contained in:
parent
0e660f5aba
commit
ee948352a5
9 changed files with 22 additions and 22 deletions
|
@ -65,8 +65,8 @@ class Artists extends Extension
|
|||
id SCORE_AIPK,
|
||||
user_id INTEGER NOT NULL,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
created TIMESTAMP NOT NULL,
|
||||
updated TIMESTAMP NOT NULL,
|
||||
created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
notes TEXT,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE
|
||||
");
|
||||
|
@ -76,8 +76,8 @@ class Artists extends Extension
|
|||
artist_id INTEGER NOT NULL,
|
||||
user_id INTEGER NOT NULL,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
created TIMESTAMP NOT NULL,
|
||||
updated TIMESTAMP NOT NULL,
|
||||
created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (artist_id) REFERENCES artists (id) ON UPDATE CASCADE ON DELETE CASCADE
|
||||
");
|
||||
|
@ -85,8 +85,8 @@ class Artists extends Extension
|
|||
id SCORE_AIPK,
|
||||
artist_id INTEGER NOT NULL,
|
||||
user_id INTEGER NOT NULL,
|
||||
created TIMESTAMP,
|
||||
updated TIMESTAMP,
|
||||
created TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
alias VARCHAR(255),
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (artist_id) REFERENCES artists (id) ON UPDATE CASCADE ON DELETE CASCADE
|
||||
|
@ -95,8 +95,8 @@ class Artists extends Extension
|
|||
id SCORE_AIPK,
|
||||
artist_id INTEGER NOT NULL,
|
||||
user_id INTEGER NOT NULL,
|
||||
created TIMESTAMP NOT NULL,
|
||||
updated TIMESTAMP NOT NULL,
|
||||
created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
url VARCHAR(1000) NOT NULL,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (artist_id) REFERENCES artists (id) ON UPDATE CASCADE ON DELETE CASCADE
|
||||
|
|
|
@ -208,7 +208,7 @@ class Favorites extends Extension
|
|||
$database->create_table("user_favorites", "
|
||||
image_id INTEGER NOT NULL,
|
||||
user_id INTEGER NOT NULL,
|
||||
created_at TIMESTAMP NOT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
UNIQUE(image_id, user_id),
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (image_id) REFERENCES images(id) ON DELETE CASCADE
|
||||
|
|
|
@ -21,8 +21,8 @@ class Forum extends Extension
|
|||
sticky SCORE_BOOL NOT NULL DEFAULT SCORE_BOOL_N,
|
||||
title VARCHAR(255) NOT NULL,
|
||||
user_id INTEGER NOT NULL,
|
||||
date TIMESTAMP NOT NULL,
|
||||
uptodate TIMESTAMP NOT NULL,
|
||||
date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
uptodate TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE RESTRICT
|
||||
");
|
||||
$database->execute("CREATE INDEX forum_threads_date_idx ON forum_threads(date)", []);
|
||||
|
@ -31,7 +31,7 @@ class Forum extends Extension
|
|||
id SCORE_AIPK,
|
||||
thread_id INTEGER NOT NULL,
|
||||
user_id INTEGER NOT NULL,
|
||||
date TIMESTAMP NOT NULL,
|
||||
date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
message TEXT,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE RESTRICT,
|
||||
FOREIGN KEY (thread_id) REFERENCES forum_threads (id) ON UPDATE CASCADE ON DELETE CASCADE
|
||||
|
|
|
@ -15,7 +15,7 @@ class LogDatabase extends Extension
|
|||
if ($config->get_int("ext_log_database_version") < 1) {
|
||||
$database->create_table("score_log", "
|
||||
id SCORE_AIPK,
|
||||
date_sent TIMESTAMP NOT NULL,
|
||||
date_sent TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
section VARCHAR(32) NOT NULL,
|
||||
username VARCHAR(32) NOT NULL,
|
||||
address SCORE_INET NOT NULL,
|
||||
|
|
|
@ -15,7 +15,7 @@ class Notes extends Extension
|
|||
image_id INTEGER NOT NULL,
|
||||
user_id INTEGER NOT NULL,
|
||||
user_ip CHAR(15) NOT NULL,
|
||||
date TIMESTAMP NOT NULL,
|
||||
date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
x1 INTEGER NOT NULL,
|
||||
y1 INTEGER NOT NULL,
|
||||
height INTEGER NOT NULL,
|
||||
|
@ -30,7 +30,7 @@ class Notes extends Extension
|
|||
id SCORE_AIPK,
|
||||
image_id INTEGER NOT NULL,
|
||||
user_id INTEGER NOT NULL,
|
||||
date TIMESTAMP NOT NULL,
|
||||
date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (image_id) REFERENCES images(id) ON DELETE CASCADE
|
||||
");
|
||||
|
@ -44,7 +44,7 @@ class Notes extends Extension
|
|||
image_id INTEGER NOT NULL,
|
||||
user_id INTEGER NOT NULL,
|
||||
user_ip CHAR(15) NOT NULL,
|
||||
date TIMESTAMP NOT NULL,
|
||||
date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
x1 INTEGER NOT NULL,
|
||||
y1 INTEGER NOT NULL,
|
||||
height INTEGER NOT NULL,
|
||||
|
|
|
@ -59,7 +59,7 @@ class PrivMsg extends Extension
|
|||
from_id INTEGER NOT NULL,
|
||||
from_ip SCORE_INET NOT NULL,
|
||||
to_id INTEGER NOT NULL,
|
||||
sent_date TIMESTAMP NOT NULL,
|
||||
sent_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
subject VARCHAR(64) NOT NULL,
|
||||
message TEXT NOT NULL,
|
||||
is_read SCORE_BOOL NOT NULL DEFAULT SCORE_BOOL_N,
|
||||
|
|
|
@ -88,7 +88,7 @@ class Pools extends Extension
|
|||
public SCORE_BOOL NOT NULL DEFAULT SCORE_BOOL_N,
|
||||
title VARCHAR(255) NOT NULL,
|
||||
description TEXT,
|
||||
date TIMESTAMP NOT NULL,
|
||||
date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
posts INTEGER NOT NULL DEFAULT 0,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE
|
||||
");
|
||||
|
@ -106,7 +106,7 @@ class Pools extends Extension
|
|||
action INTEGER NOT NULL,
|
||||
images TEXT,
|
||||
count INTEGER NOT NULL DEFAULT 0,
|
||||
date TIMESTAMP NOT NULL,
|
||||
date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (pool_id) REFERENCES pools(id) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE
|
||||
");
|
||||
|
|
|
@ -101,7 +101,7 @@ class SourceHistory extends Extension
|
|||
user_id INTEGER NOT NULL,
|
||||
user_ip SCORE_INET NOT NULL,
|
||||
source TEXT NOT NULL,
|
||||
date_set TIMESTAMP NOT NULL,
|
||||
date_set TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (image_id) REFERENCES images(id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
|
||||
");
|
||||
|
|
|
@ -102,7 +102,7 @@ class TagHistory extends Extension
|
|||
user_id INTEGER NOT NULL,
|
||||
user_ip SCORE_INET NOT NULL,
|
||||
tags TEXT NOT NULL,
|
||||
date_set TIMESTAMP NOT NULL,
|
||||
date_set TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (image_id) REFERENCES images(id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
|
||||
");
|
||||
|
@ -112,7 +112,7 @@ class TagHistory extends Extension
|
|||
|
||||
if ($config->get_int("ext_tag_history_version") == 1) {
|
||||
$database->Execute("ALTER TABLE tag_histories ADD COLUMN user_id INTEGER NOT NULL");
|
||||
$database->Execute($database->scoreql_to_sql("ALTER TABLE tag_histories ADD COLUMN date_set TIMESTAMP NOT NULL"));
|
||||
$database->Execute("ALTER TABLE tag_histories ADD COLUMN date_set TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP");
|
||||
$config->set_int("ext_tag_history_version", 2);
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue