You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for putting this all together! It is crazy that until now, this is not part of Doctrine...
In a Symfony 6.4 project, I noticed that the command php bin/console make:migration would always bring up the db-columns as changed and would include a line into the migration file looking something like this:
$this->addSql('ALTER TABLE admin_user_log CHANGE created_at created_at DATETIME(6) NOT NULL');
To get around this problem, I added this to BaseDateTimeMicroWithoutTz / BaseDateTimeMicroWithTz / BaseTimeMicro:
public function requiresSQLCommentHint(AbstractPlatform $platform): bool
{
return true;
}
With this, the column will be created with a comment, in my case (DC2Type:datetime_immutable_micro) and the Maker-Bundle will recognize the column mapping correctly.
requiresSQLCommentHint() is marked as deprecated and won't be available in DBAL version 4. But as Symfony 6.4 is still using it, I was fine taking the same approach. So as soon as Symfony switches to DBAL 4 and ORM 3, this has to be reworked.
The text was updated successfully, but these errors were encountered:
Seesicht-IT
changed the title
Symfony make:migration requires CommentHint
Symfony 6.4 make:migration requires CommentHint
Jul 1, 2024
Thanks for putting this all together! It is crazy that until now, this is not part of Doctrine...
In a Symfony 6.4 project, I noticed that the command
php bin/console make:migration
would always bring up the db-columns as changed and would include a line into the migration file looking something like this:To get around this problem, I added this to
BaseDateTimeMicroWithoutTz
/BaseDateTimeMicroWithTz
/BaseTimeMicro
:With this, the column will be created with a comment, in my case
(DC2Type:datetime_immutable_micro)
and the Maker-Bundle will recognize the column mapping correctly.requiresSQLCommentHint()
is marked as deprecated and won't be available in DBAL version 4. But as Symfony 6.4 is still using it, I was fine taking the same approach. So as soon as Symfony switches to DBAL 4 and ORM 3, this has to be reworked.The text was updated successfully, but these errors were encountered: