Skip to content

Instantly share code, notes, and snippets.

@igoralves1
Last active August 7, 2017 14:09
Show Gist options
  • Save igoralves1/de93643c078c71c574f2f45fd45a1bf0 to your computer and use it in GitHub Desktop.
Save igoralves1/de93643c078c71c574f2f45fd45a1bf0 to your computer and use it in GitHub Desktop.
SQL => DEFAULT CURRENT_TIMESTAMP => Insert timestamp by default in a Table
/*
Just use the CURRENT_TIMESTAMP as DEFAULT
when creating the table.
In the query we will not need to insert
any date.
That will be automatically inserted by
mysql engine
*/
CREATE TABLE `db_Logs` (
`id` BIGINT(20) NOT NULL AUTO_INCREMENT,
`dt_llog` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
`msg` MEDIUMTEXT NULL,
`sql` MEDIUMTEXT NULL,
`StackTrace` MEDIUMTEXT NULL,
`exceptionObjc` MEDIUMTEXT NULL,
PRIMARY KEY (`id`)
)
COLLATE='latin1_swedish_ci'
ENGINE=InnoDB
AUTO_INCREMENT=32290
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment