From 20b3f67cbf1efc4bd4c9cee0fdec41aaf413291c Mon Sep 17 00:00:00 2001 From: bmf-san Date: Sat, 4 May 2024 10:16:41 +0900 Subject: [PATCH] [fix] created_at --- mysql/initdb.d/1_schema.sql | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mysql/initdb.d/1_schema.sql b/mysql/initdb.d/1_schema.sql index ae8dc76..e1c8dfb 100644 --- a/mysql/initdb.d/1_schema.sql +++ b/mysql/initdb.d/1_schema.sql @@ -4,7 +4,7 @@ CREATE TABLE `admins` ( `name` varchar(255) NOT NULL UNIQUE, `email` varchar(255) NOT NULL UNIQUE, `password` varchar(255) NOT NULL, - `created_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created_at` datetime DEFAULT CURRENT_TIMESTAMP, `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE = InnoDB DEFAULT CHARSET = utf8; @@ -12,7 +12,7 @@ DROP TABLE IF EXISTS `categories`; CREATE TABLE `categories` ( `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, `name` varchar(255) NOT NULL UNIQUE, - `created_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created_at` datetime DEFAULT CURRENT_TIMESTAMP, `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE = InnoDB DEFAULT CHARSET = utf8; @@ -25,7 +25,7 @@ CREATE TABLE `posts` ( `md_body` longtext DEFAULT NULL, `html_body` longtext DEFAULT NULL, `status` varchar(255) DEFAULT "draft", - `created_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created_at` datetime DEFAULT CURRENT_TIMESTAMP, `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, FOREIGN KEY (admin_id) REFERENCES admins(id), FOREIGN KEY (category_id) REFERENCES categories(id) @@ -37,7 +37,7 @@ CREATE TABLE `comments` ( `post_id` int(11) UNSIGNED NOT NULL, `body` longtext NOT NULL, `status` varchar(255) DEFAULT "pending", - `created_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created_at` datetime DEFAULT CURRENT_TIMESTAMP, `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, FOREIGN KEY (post_id) REFERENCES posts(id) ) ENGINE = InnoDB DEFAULT CHARSET = utf8; @@ -46,7 +46,7 @@ DROP TABLE IF EXISTS `tags`; CREATE TABLE `tags` ( `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, `name` varchar(255) NOT NULL UNIQUE, - `created_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created_at` datetime DEFAULT CURRENT_TIMESTAMP, `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE = InnoDB DEFAULT CHARSET = utf8; @@ -55,7 +55,7 @@ CREATE TABLE `tag_post` ( `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, `tag_id` int(11) UNSIGNED NOT NULL, `post_id` int(11) UNSIGNED NOT NULL, - `created_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created_at` datetime DEFAULT CURRENT_TIMESTAMP, `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, FOREIGN KEY (tag_id) REFERENCES tags(id), FOREIGN KEY (post_id) REFERENCES posts(id)