Skip to content
New issue

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

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

Already on GitHub? # to your account

Use safer default TIMESTAMP for MySQL. #3424

Merged
merged 1 commit into from
Oct 3, 2022

Conversation

robholland
Copy link
Contributor

What changed?

Use a more widely compatible default timestamp for columns which require one on MySQL.

Why?

This avoids the timezone suffix syntax that is not supported by all MySQL versions/derivatives (MariaDB 10.6.8 on RDS being an example). Fixes #119 by being 24 hours after the minimum timestamp value, making it a valid value even if MySQL does a large timezone adjustment to UTC before storing.

How did you test it?

Used modified schema to update-schema on MariaDB.

Potential risks

Any defaulted timestamps would have an unusual default which is not-quite-the-epoch. I don't think this is a problem.

Is hotfix candidate?

No.

This avoids compatibility issues with differing versions of MySQL.

Using 24 hours after the minimum timestamp value allows for any timezone adjustment that MySQL would do to get a UTC value before storing. The timezone suffix is not supported by all current MySQL versions/derivatives.

Fixes #119
@robholland robholland requested a review from a team as a code owner September 23, 2022 16:24
@robholland robholland changed the title Use safer default TIMESTAMP. Use safer default TIMESTAMP for MySQL. Oct 3, 2022
@robholland robholland merged commit 175b916 into master Oct 3, 2022
@robholland robholland deleted the robholland-mysql-timezone-fix branch October 3, 2022 09:30
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set Explicit Default for all Timestamp Values in MySQL Schema
2 participants