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

Symfony 6.4 make:migration requires CommentHint #1

Open
Seesicht-IT opened this issue Jul 1, 2024 · 0 comments
Open

Symfony 6.4 make:migration requires CommentHint #1

Seesicht-IT opened this issue Jul 1, 2024 · 0 comments

Comments

@Seesicht-IT
Copy link

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.

@Seesicht-IT Seesicht-IT changed the title Symfony make:migration requires CommentHint Symfony 6.4 make:migration requires CommentHint Jul 1, 2024
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

No branches or pull requests

1 participant