Skip to content

fix(MySQL): render CURRENT_TIMESTAMP with the column's fractional seconds precision - #278

Open
roxblnfk wants to merge 2 commits into
2.xfrom
fix/277-mysql-datetime-precision-now
Open

roxblnfk wants to merge 2 commits into
2.xfrom
fix/277-mysql-datetime-precision-now

Conversation

@roxblnfk

@roxblnfk roxblnfk commented Oct 5, 2026

Copy link
Copy Markdown
Member

🔍 What was changed

  • datetime / timestamp columns with a size and defaultValue(AbstractColumn::DATETIME_NOW) render DEFAULT CURRENT_TIMESTAMP(N) on MySQL, so datetime(6) no longer fails with error 1067.
  • A reflected CURRENT_TIMESTAMP(N) default (MariaDB: current_timestamp(N)) is read as DATETIME_NOW: reading such a column no longer throws, and saving the same declaration again produces no diff.

Review notes

  • Changing only the precision of an existing column (datetime → datetime(6)) still produces no ALTER, because size is excluded from MySQL column comparison. That is unchanged here.

Checklist

…nal seconds

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
…onds precision

MySQL rejects `datetime(6) DEFAULT CURRENT_TIMESTAMP` with error 1067: the default must carry the same precision as the column. The reflected `CURRENT_TIMESTAMP(6)` (MariaDB: `current_timestamp(6)`) is normalized back to `DATETIME_NOW`, so reading such a column no longer throws and saving the same declaration again gives no diff.

Fixes #277

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
@roxblnfk
roxblnfk requested review from a team as code owners October 5, 2026 13:44
@codecov

codecov Bot commented Oct 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.74%. Comparing base (73a8306) to head (ceda1f0).

Additional details and impacted files
@@             Coverage Diff              @@
##                2.x     #278      +/-   ##
============================================
+ Coverage     95.72%   95.74%   +0.01%     
- Complexity     2246     2251       +5     
============================================
  Files           142      142              
  Lines          6384     6389       +5     
============================================
+ Hits           6111     6117       +6     
+ Misses          273      272       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: MySQL datetime with precision fails with CURRENT_TIMESTAMP default

1 participant