Skip to content

Instantly share code, notes, and snippets.

@FerraBraiZ
Last active April 27, 2018 13:10
Show Gist options
  • Save FerraBraiZ/1641d8aff3a211954da81a788991f3cb to your computer and use it in GitHub Desktop.
Save FerraBraiZ/1641d8aff3a211954da81a788991f3cb to your computer and use it in GitHub Desktop.
MySQL - 5.6.5 2, 2 TIMESTAMP column / CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
Why there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause?
in MySQL 5.6.5 (2012-04-10, Milestone 8) is possible to have 2 fields, as follows:
CREATE TABLE `foo` (
`id` INT(10) UNSIGNED NOT NULL,
`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at ` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=INNODB;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment