Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set default value for timestamp fields to CURRENT_TIMESTAMP #17

Merged
merged 1 commit into from May 7, 2017

Conversation

MrSnoozles
Copy link

Since MySQL 5.7 SQL mode "NO_ZERO_DATE" is enabled by default. That means date fields which are not nullable need a default value ("0000-00-00" is not allowed). Therefore we set the default value to CURRENT_TIMESTAMP so - unless specifically defined in the insert statement - the current timestamp will be used. I guess that makes sense for both created_at and updated_at.

@MrSnoozles
Copy link
Author

I tested the installation and with those modifications it works without any errors. Still wondering about the schema-update-v*.sql files though. There are timestamp fields with default values 0000-00-00 00:00:00. They do not seem to cause any errors.

@mikerockett
Copy link
Owner

mikerockett commented May 7, 2017

Thanks - I'll merge this in and make the same change to the updates for consistency.

Thanks - I've merged this in. Not updating the updates as you say they do work. Don't want to break anything either. 😃

@mikerockett mikerockett merged commit f41d344 into mikerockett:master May 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants