This commit is contained in:
Shish 2019-11-03 19:25:51 +00:00
parent 0e660f5aba
commit ee948352a5
9 changed files with 22 additions and 22 deletions

View file

@ -65,8 +65,8 @@ class Artists extends Extension
id SCORE_AIPK, id SCORE_AIPK,
user_id INTEGER NOT NULL, user_id INTEGER NOT NULL,
name VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL,
created TIMESTAMP NOT NULL, created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated TIMESTAMP NOT NULL, updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
notes TEXT, notes TEXT,
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
"); ");
@ -76,8 +76,8 @@ class Artists extends Extension
artist_id INTEGER NOT NULL, artist_id INTEGER NOT NULL,
user_id INTEGER NOT NULL, user_id INTEGER NOT NULL,
name VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL,
created TIMESTAMP NOT NULL, created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated TIMESTAMP NOT NULL, updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
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,
FOREIGN KEY (artist_id) REFERENCES artists (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, id SCORE_AIPK,
artist_id INTEGER NOT NULL, artist_id INTEGER NOT NULL,
user_id INTEGER NOT NULL, user_id INTEGER NOT NULL,
created TIMESTAMP, created TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated TIMESTAMP, updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
alias VARCHAR(255), alias VARCHAR(255),
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,
FOREIGN KEY (artist_id) REFERENCES artists (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, id SCORE_AIPK,
artist_id INTEGER NOT NULL, artist_id INTEGER NOT NULL,
user_id INTEGER NOT NULL, user_id INTEGER NOT NULL,
created TIMESTAMP NOT NULL, created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated TIMESTAMP NOT NULL, updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
url VARCHAR(1000) NOT NULL, url VARCHAR(1000) NOT NULL,
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,
FOREIGN KEY (artist_id) REFERENCES artists (id) ON UPDATE CASCADE ON DELETE CASCADE FOREIGN KEY (artist_id) REFERENCES artists (id) ON UPDATE CASCADE ON DELETE CASCADE

View file

@ -208,7 +208,7 @@ class Favorites extends Extension
$database->create_table("user_favorites", " $database->create_table("user_favorites", "
image_id INTEGER NOT NULL, image_id INTEGER NOT NULL,
user_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), UNIQUE(image_id, user_id),
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE, FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
FOREIGN KEY (image_id) REFERENCES images(id) ON DELETE CASCADE FOREIGN KEY (image_id) REFERENCES images(id) ON DELETE CASCADE

View file

@ -21,8 +21,8 @@ class Forum extends Extension
sticky SCORE_BOOL NOT NULL DEFAULT SCORE_BOOL_N, sticky SCORE_BOOL NOT NULL DEFAULT SCORE_BOOL_N,
title VARCHAR(255) NOT NULL, title VARCHAR(255) NOT NULL,
user_id INTEGER NOT NULL, user_id INTEGER NOT NULL,
date TIMESTAMP NOT NULL, date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
uptodate TIMESTAMP NOT NULL, uptodate TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE RESTRICT 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)", []); $database->execute("CREATE INDEX forum_threads_date_idx ON forum_threads(date)", []);
@ -31,7 +31,7 @@ class Forum extends Extension
id SCORE_AIPK, id SCORE_AIPK,
thread_id INTEGER NOT NULL, thread_id INTEGER NOT NULL,
user_id INTEGER NOT NULL, user_id INTEGER NOT NULL,
date TIMESTAMP NOT NULL, date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
message TEXT, message TEXT,
FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE RESTRICT, 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 FOREIGN KEY (thread_id) REFERENCES forum_threads (id) ON UPDATE CASCADE ON DELETE CASCADE

View file

@ -15,7 +15,7 @@ class LogDatabase extends Extension
if ($config->get_int("ext_log_database_version") < 1) { if ($config->get_int("ext_log_database_version") < 1) {
$database->create_table("score_log", " $database->create_table("score_log", "
id SCORE_AIPK, id SCORE_AIPK,
date_sent TIMESTAMP NOT NULL, date_sent TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
section VARCHAR(32) NOT NULL, section VARCHAR(32) NOT NULL,
username VARCHAR(32) NOT NULL, username VARCHAR(32) NOT NULL,
address SCORE_INET NOT NULL, address SCORE_INET NOT NULL,

View file

@ -15,7 +15,7 @@ class Notes extends Extension
image_id INTEGER NOT NULL, image_id INTEGER NOT NULL,
user_id INTEGER NOT NULL, user_id INTEGER NOT NULL,
user_ip CHAR(15) NOT NULL, user_ip CHAR(15) NOT NULL,
date TIMESTAMP NOT NULL, date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
x1 INTEGER NOT NULL, x1 INTEGER NOT NULL,
y1 INTEGER NOT NULL, y1 INTEGER NOT NULL,
height INTEGER NOT NULL, height INTEGER NOT NULL,
@ -30,7 +30,7 @@ class Notes extends Extension
id SCORE_AIPK, id SCORE_AIPK,
image_id INTEGER NOT NULL, image_id INTEGER NOT NULL,
user_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 (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (image_id) REFERENCES images(id) 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, image_id INTEGER NOT NULL,
user_id INTEGER NOT NULL, user_id INTEGER NOT NULL,
user_ip CHAR(15) NOT NULL, user_ip CHAR(15) NOT NULL,
date TIMESTAMP NOT NULL, date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
x1 INTEGER NOT NULL, x1 INTEGER NOT NULL,
y1 INTEGER NOT NULL, y1 INTEGER NOT NULL,
height INTEGER NOT NULL, height INTEGER NOT NULL,

View file

@ -59,7 +59,7 @@ class PrivMsg extends Extension
from_id INTEGER NOT NULL, from_id INTEGER NOT NULL,
from_ip SCORE_INET NOT NULL, from_ip SCORE_INET NOT NULL,
to_id INTEGER 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, subject VARCHAR(64) NOT NULL,
message TEXT NOT NULL, message TEXT NOT NULL,
is_read SCORE_BOOL NOT NULL DEFAULT SCORE_BOOL_N, is_read SCORE_BOOL NOT NULL DEFAULT SCORE_BOOL_N,

View file

@ -88,7 +88,7 @@ class Pools extends Extension
public SCORE_BOOL NOT NULL DEFAULT SCORE_BOOL_N, public SCORE_BOOL NOT NULL DEFAULT SCORE_BOOL_N,
title VARCHAR(255) NOT NULL, title VARCHAR(255) NOT NULL,
description TEXT, description TEXT,
date TIMESTAMP NOT NULL, date 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
"); ");
@ -106,7 +106,7 @@ class Pools extends Extension
action INTEGER NOT NULL, action INTEGER NOT NULL,
images TEXT, images TEXT,
count INTEGER NOT NULL DEFAULT 0, 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 (pool_id) REFERENCES pools(id) ON UPDATE CASCADE ON DELETE CASCADE,
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
"); ");

View file

@ -101,7 +101,7 @@ class SourceHistory extends Extension
user_id INTEGER NOT NULL, user_id INTEGER NOT NULL,
user_ip SCORE_INET NOT NULL, user_ip SCORE_INET NOT NULL,
source TEXT 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 (image_id) REFERENCES images(id) ON DELETE CASCADE,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
"); ");

View file

@ -102,7 +102,7 @@ class TagHistory extends Extension
user_id INTEGER NOT NULL, user_id INTEGER NOT NULL,
user_ip SCORE_INET NOT NULL, user_ip SCORE_INET NOT NULL,
tags TEXT 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 (image_id) REFERENCES images(id) ON DELETE CASCADE,
FOREIGN KEY (user_id) REFERENCES users(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) { if ($config->get_int("ext_tag_history_version") == 1) {
$database->Execute("ALTER TABLE tag_histories ADD COLUMN user_id INTEGER NOT NULL"); $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); $config->set_int("ext_tag_history_version", 2);
} }