Skip to content

Commit

Permalink
Added a default value of CURRENT_TIMESTAMP to the 'last_login' column…
Browse files Browse the repository at this point in the history
… in the 'users' table to automatically capture the latest login time, enhancing user tracking and engagement monitoring.
  • Loading branch information
GitHub Gen Changes committed Nov 7, 2024
1 parent 30d773c commit 343a8e2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions dirs/ecommerce/migrations/20241107131023.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Modify "users" table
ALTER TABLE `users` MODIFY COLUMN `last_login` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT "Timestamp of the last login of the user";
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:4DPrdpTqQndedAjeax6vOukg4FQNAlTRXrcWZ6yEmCQ=
h1:VSgYYYLSJhU5/Y7ZagWoPjc/Tlm9/OPPc36Eq5d5UDI=
20230316085611.sql h1:br6W6LPEnnsejlz/7hRm9zthwStCzjN2vZkqVPxlmvo=
20230316090502.sql h1:GfeRjkSeoCt3JVRtLQNa/r50lRfpAPXS7AqTU2ZNFgY=
20230531091333_products_categories.sql h1:59q2M59dV5dJNv4Lyb2TAJz8V6HekgkLn9z4DoL98jA=
Expand Down Expand Up @@ -57,3 +57,4 @@ h1:4DPrdpTqQndedAjeax6vOukg4FQNAlTRXrcWZ6yEmCQ=
20241029131228.sql h1:DzldiBTksxEdcKfy5vyShSvEE6Q5iU2m7NShpkUwCRA=
20241031131151.sql h1:XisKAigww2gisByYOPuIgNQcBOVX/AVKLNt0KGPrlU0=
20241105131055.sql h1:Pa43oRSXYgYlTyRPmz+ifOUdjC37MBxXty/y6GLCaqk=
20241107131023.sql h1:ZCiG0I6S1KZRirv89U4894V9ZBuG6ChLYDuPyWC098c=
2 changes: 1 addition & 1 deletion dirs/ecommerce/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ CREATE TABLE `users` (
`date_of_birth` date NULL,
`gender` ENUM('male', 'female', 'other') NULL COMMENT 'User gender',
`active` bool NOT NULL DEFAULT 1 COMMENT 'Flag indicating if the user account is active, defaults to true',
`last_login` timestamp NULL,
`last_login` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Timestamp of the last login of the user',
`address` varchar(255) NULL,
`profile_picture_url` varchar(255) NULL COMMENT 'URL to the user profile picture',
`phone_verified` bool NOT NULL DEFAULT 0 COMMENT 'Flag indicating if the user phone number is verified, defaults to false',
Expand Down

0 comments on commit 343a8e2

Please sign in to comment.