From ee948352a54cc3126474a94551be41c2d12424bc Mon Sep 17 00:00:00 2001 From: Shish Date: Sun, 3 Nov 2019 19:25:51 +0000 Subject: [PATCH] defaults --- ext/artists/main.php | 16 ++++++++-------- ext/favorites/main.php | 2 +- ext/forum/main.php | 6 +++--- ext/log_db/main.php | 2 +- ext/notes/main.php | 6 +++--- ext/pm/main.php | 2 +- ext/pools/main.php | 4 ++-- ext/source_history/main.php | 2 +- ext/tag_history/main.php | 4 ++-- 9 files changed, 22 insertions(+), 22 deletions(-) diff --git a/ext/artists/main.php b/ext/artists/main.php index 8e22c67f..062c8df5 100644 --- a/ext/artists/main.php +++ b/ext/artists/main.php @@ -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 diff --git a/ext/favorites/main.php b/ext/favorites/main.php index b6ea338b..10f4f784 100644 --- a/ext/favorites/main.php +++ b/ext/favorites/main.php @@ -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 diff --git a/ext/forum/main.php b/ext/forum/main.php index d26bdd25..25f233ba 100644 --- a/ext/forum/main.php +++ b/ext/forum/main.php @@ -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 diff --git a/ext/log_db/main.php b/ext/log_db/main.php index 8a86d8a9..73a77c36 100644 --- a/ext/log_db/main.php +++ b/ext/log_db/main.php @@ -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, diff --git a/ext/notes/main.php b/ext/notes/main.php index cb14c280..651967e9 100644 --- a/ext/notes/main.php +++ b/ext/notes/main.php @@ -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, diff --git a/ext/pm/main.php b/ext/pm/main.php index 7b842aef..f55bcd63 100644 --- a/ext/pm/main.php +++ b/ext/pm/main.php @@ -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, diff --git a/ext/pools/main.php b/ext/pools/main.php index 85f0e06c..e87bdf5d 100644 --- a/ext/pools/main.php +++ b/ext/pools/main.php @@ -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 "); diff --git a/ext/source_history/main.php b/ext/source_history/main.php index 701fb91b..c4f50a5c 100644 --- a/ext/source_history/main.php +++ b/ext/source_history/main.php @@ -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 "); diff --git a/ext/tag_history/main.php b/ext/tag_history/main.php index 0bf40949..9a25d223 100644 --- a/ext/tag_history/main.php +++ b/ext/tag_history/main.php @@ -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); }