I'm trying to add two DATETIME columns to my User_Accounts table.
I create the columns in MySQL workbench like so: DATETIME(6)
What am I doing wrong?
MySQL comes with the following data types for storing a date or a date/time value in the database: DATE - format YYYY-MM-DD. DATETIME - format: YYYY-MM-DD HH:MI:SS. TIMESTAMP - format: YYYY-MM-DD HH:MI:SS.
The DATETIME type is used for values that contain both date and time parts. MySQL retrieves and displays DATETIME values in ' YYYY-MM-DD hh:mm:ss ' format. The supported range is '1000-01-01 00:00:00' to '9999-12-31 23:59:59' . The TIMESTAMP data type is used for values that contain both date and time parts.
DATETIME has a default of NULL unless defined with the NOT NULL attribute, in which case the default is 0.
Remove that size specifier (6)
from your ALTER
statement.
ALTER TABLE `Chessmates`.`User_Accounts`
CHANGE COLUMN `Country` `Country` TEXT(25) NOT NULL ,
ADD COLUMN `created_at` DATETIME NOT NULL AFTER `salt`,
ADD COLUMN `updated_at` DATETIME NULL DEFAULT NULL AFTER `created_at`
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With