Skip to content

add getDateTimeFormat() method to \Cycle\Database\Driver\Driver - #264

Closed
ddrv wants to merge 1 commit into
cycle:2.xfrom
ddrv-fork:driver-datetime-format
Closed

add getDateTimeFormat() method to \Cycle\Database\Driver\Driver#264
ddrv wants to merge 1 commit into
cycle:2.xfrom
ddrv-fork:driver-datetime-format

Conversation

@ddrv

@ddrv ddrv commented Aug 12, 2026

Copy link
Copy Markdown

🔍 What was changed

A method for obtaining the time storage format has been added to the driver class. To avoid breaking backward compatibility, a separate interface has been allocated for this method.

🤔 Why?

In some cases, it is necessary to know in what format time is stored.
For example, see Issue 66 of cycle/migrations

📝 Checklist

  • How was this tested:
    • Tested manually
    • Unit tests added

@ddrv
ddrv requested review from a team as code owners August 12, 2026 08:27
@roxblnfk

Copy link
Copy Markdown
Member

Thank you for the PR and for digging into cycle/migrations#66!

After investigating, we fixed the issue entirely on the cycle/migrations side in cycle/migrations#67, without needing a new driver API: the migrator now passes created_at to the WHERE clause as a DateTimeInterface object instead of a pre-formatted string, so the driver formats it exactly the same way as on insert — consistently with the withDatetimeMicroseconds option. The migration table's datetime columns are also created with datetime(6) now, which fixes the related failure on SQL Server (legacy DATETIME rejects values with microseconds).

Since getDateTimeFormat() is no longer required for that fix, I'm closing this PR. If a use case comes up where exposing the driver's datetime format is genuinely needed, we can revisit the idea.

@roxblnfk roxblnfk closed this Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants