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

Support DateTime instances #736

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Tigrov
Copy link
Member

@Tigrov Tigrov commented Aug 5, 2023

Some comments are left for review and will be removed after.

ColumnSchema::dateTimeFormat() and ColumnSchema::$dateTimeFormat can be removed, in this case it will be necessary to determine the format from ColumnSchema each time when casting values.

Update 09.08.2023

ColumnSchema::hasTimezone() can be replaced with two new abstract types SchemaInterface::TYPE_TIMESTAMPTZ and SchemaInterface::TYPE_TIMETZ

Both options (remove methods) can be done without loss of performance if type casting will be optimized as here #737

Q A
Is bugfix?
New feature? ✔️
Breaks BC? ✔️
Fixed issues #725

@what-the-diff
Copy link

what-the-diff bot commented Aug 5, 2023

PR Summary

  • Addition of dateTimeFormat property in AbstractColumnSchema class
    A new setting has been added to our digital blueprint for columns (AbstractColumnSchema class). This new addition allows us to specify the format in which dates and times will be presented when changing from DateTimeInterface to a format that fits into databases. This is achieved with two new features dateTimeFormat() and getDateTimeFormat().

  • New method getDateTimeFormat() in AbstractSchema class
    A new feature has been incorporated into our main blueprint (AbstractSchema class) which fetches the date and time format according to the type of column we are dealing with.

  • Introduction of dateTimeFormat() method to ColumnSchemaInterface interface
    We've added a new approach in our contract (ColumnSchemaInterface interface) for setting up column types. The function, dateTimeFormat(), will now set the date and time format specifically for each column type.

  • Creation of PHP_TYPE_DATE_TIME constant in SchemaInterface interface
    A new constant label PHP_TYPE_DATE_TIME has been included in our blueprint (SchemaInterface), which represents the PHP type DateTimeInterface.

  • New tests in CommonSchemaTest class
    Lastly, we've added checks in our testing class (CommonSchemaTest) to confirm the correctness of the new date and time format feature.

@codecov
Copy link

codecov bot commented Aug 5, 2023

Codecov Report

Patch coverage: 97.91% and project coverage change: +0.16% 🎉

Comparison is base (c5aa0b1) 89.59% compared to head (e71d368) 89.76%.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #736      +/-   ##
============================================
+ Coverage     89.59%   89.76%   +0.16%     
- Complexity     1375     1396      +21     
============================================
  Files            67       67              
  Lines          3382     3428      +46     
============================================
+ Hits           3030     3077      +47     
+ Misses          352      351       -1     
Files Changed Coverage Δ
src/Schema/AbstractColumnSchema.php 99.15% <96.00%> (-0.85%) ⬇️
src/Schema/AbstractSchema.php 99.48% <100.00%> (+0.06%) ⬆️

... and 2 files with indirect coverage changes

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

@Tigrov Tigrov marked this pull request as ready for review August 5, 2023 16:17
@Tigrov Tigrov marked this pull request as draft August 17, 2023 13:50
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.

None yet

1 participant