-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
DBAL does not support default parameter for datetime types #3142
Comments
Just including part of the composer.json for your reference..
{ |
Not going to happen for a few reasons:
Closing here as |
|
@ostrolucky my bad! Indeed the expression exists elsewhere too, but the other engines support multiple expressions for Amending my comment above. https://dev.mysql.com/doc/refman/8.0/en/create-table.html states:
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
In more recent versions of dbal, the insertion of default option for datetime is no longer being performed, with the result that you're unable to generate a DB schema with a default CURRENT_TIMESTAMP.
/**
* @var \DateTime
*
* @Orm\Column(name="time_added", type="datetime", nullable=false, options={"DEFAULT"="CURRENT_TIMESTAMP"})
*/
private $timeAdded;
dbal developers should be aware that in some situations, PHP might not be the only language interfacing with the database. Using Doctrine & DBAL does simplify database maintenance in a development cycle and enables simple updates thought the very simple to use migrations, however the caveat that we cannot set a default value for a datetime is taking things too far and not encouraging developers to think for themselves in a very dynamic system.
I highly encourage for this feature to be brought back as it is very useful.
The text was updated successfully, but these errors were encountered: