Skip to content

Commit

Permalink
Added a 'created_at' column to the 'posts' table with default current…
Browse files Browse the repository at this point in the history
… timestamp to track when each post is created. (#109)

Co-authored-by: GitHub Gen Changes <>
  • Loading branch information
ariga-bot authored Nov 10, 2024
1 parent 5f6bd97 commit 1549077
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions dirs/ecommerce/migrations/20241110130904.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Modify "posts" table
ALTER TABLE `posts` ADD COLUMN `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT "Timestamp of when the post was created";
3 changes: 2 additions & 1 deletion dirs/ecommerce/migrations/atlas.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
h1:VSgYYYLSJhU5/Y7ZagWoPjc/Tlm9/OPPc36Eq5d5UDI=
h1:mQ4os5dvdZVxq9ucRsiEYty95umfc04MMDQfT68e+VI=
20230316085611.sql h1:br6W6LPEnnsejlz/7hRm9zthwStCzjN2vZkqVPxlmvo=
20230316090502.sql h1:GfeRjkSeoCt3JVRtLQNa/r50lRfpAPXS7AqTU2ZNFgY=
20230531091333_products_categories.sql h1:59q2M59dV5dJNv4Lyb2TAJz8V6HekgkLn9z4DoL98jA=
Expand Down Expand Up @@ -58,3 +58,4 @@ h1:VSgYYYLSJhU5/Y7ZagWoPjc/Tlm9/OPPc36Eq5d5UDI=
20241031131151.sql h1:XisKAigww2gisByYOPuIgNQcBOVX/AVKLNt0KGPrlU0=
20241105131055.sql h1:Pa43oRSXYgYlTyRPmz+ifOUdjC37MBxXty/y6GLCaqk=
20241107131023.sql h1:ZCiG0I6S1KZRirv89U4894V9ZBuG6ChLYDuPyWC098c=
20241110130904.sql h1:qRQ+S6KPxiFyp8VxRMkZIFVop3rO1qrS3EJpKz2gjhw=
3 changes: 2 additions & 1 deletion dirs/ecommerce/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ CREATE TABLE `posts` (
`title` varchar(255) NOT NULL,
`body` text NOT NULL,
`last_updated_by` int NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Timestamp of when the post was created',
PRIMARY KEY (`id`),
INDEX `user_id` (`user_id`),
CONSTRAINT `posts_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON UPDATE NO ACTION ON DELETE CASCADE,
Expand All @@ -151,4 +152,4 @@ CREATE TABLE `payment_methods` (
PRIMARY KEY (`id`),
INDEX `user_id` (`user_id`),
CONSTRAINT `payment_methods_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON UPDATE NO ACTION ON DELETE CASCADE
) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci;

0 comments on commit 1549077

Please sign in to comment.