mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DBAL deprecation about CURRENT_TIMESTAMP #7568
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @greg0ire on GitHub (Oct 29, 2025).
Since https://github.com/doctrine/dbal/pull/7195 , using e.g. the string
CURRENT_TIMESTAMPto represent a default expression for a column is deprecated in favor of using a value object.To get details on the issue:
The following patch is sufficient to make the issue go away, but introduces a breaking change:
We should probably aim for this for the next major version.
Another way to address the issue is this:
Arguably, it's also a breaking change. Maybe the column type should be checked as well.
@derrabus commented on GitHub (Oct 30, 2025):
I think, the second solution is what we should do to get ORM applications deprecation-free in short therm.
@greg0ire commented on GitHub (Nov 9, 2025):
Ah, I just saw that
CURRENT_TIMESTAMPis not hardcoded at theAbstractPlatformlevel. It can vary per platform:7e29724ee7/src/Platforms/AbstractPlatform.php (L1543-L1553)We should have the same kind of checks as this:
$type instanceof Types\PhpDateTimeMappingType && $default === $this->getCurrentTimestampSQL()Something like this:
@greg0ire commented on GitHub (Nov 9, 2025):
Here is an attempt at implementing solution 2: https://github.com/doctrine/orm/pull/12262
@greg0ire commented on GitHub (Nov 13, 2025):
Merged. Now I'm thinking about the next steps.
Altering the type ofWe'll be usingFieldMapping::$defaultis a breaking change for consumers as well as extending classes. I think it might be an acceptable breaking change though.$options['default']I deprecated$defaultin favor of that.Or mabye like this, so as to allow specifying a class only for
default?@D3strukt0r commented on GitHub (Jan 22, 2026):
as someone using this in a Symfony I'm confused as to what I'm expected to change it to
before
now it's this?
this gives me this in the migrations though
so I'm really confused, pls help. can I even do something to get rid of the deprecation message at this point?