Support DateTime instances
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 |
PR Summary
-
Addition of
dateTimeFormatproperty inAbstractColumnSchemaclass 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 featuresdateTimeFormat()andgetDateTimeFormat(). -
New method
getDateTimeFormat()inAbstractSchemaclass 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 toColumnSchemaInterfaceinterface 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_TIMEconstant inSchemaInterfaceinterface A new constant labelPHP_TYPE_DATE_TIMEhas been included in our blueprint (SchemaInterface), which represents the PHP typeDateTimeInterface. -
New tests in
CommonSchemaTestclass Lastly, we've added checks in our testing class (CommonSchemaTest) to confirm the correctness of the new date and time format feature.
Codecov Report
Attention: Patch coverage is 97.91667% with 1 line in your changes missing coverage. Please review.
Project coverage is 89.76%. Comparing base (
c5aa0b1) to head (e71d368). Report is 175 commits behind head on master.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| src/Schema/AbstractColumnSchema.php | 96.00% | 1 Missing :warning: |
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
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.