Skip to content

Commit

Permalink
Merge pull request #114 from bmf-san/fix/created_at_schema
Browse files Browse the repository at this point in the history
Removed the ON UPDATE clause of created_at
  • Loading branch information
bmf-san authored May 4, 2024
2 parents 725965c + 20b3f67 commit d32bb8a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions mysql/initdb.d/1_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ 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;

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;

Expand All @@ -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)
Expand All @@ -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;
Expand All @@ -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;

Expand All @@ -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)
Expand Down

0 comments on commit d32bb8a

Please sign in to comment.