-
-
Notifications
You must be signed in to change notification settings - Fork 390
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
Charset and Collation leads to down-Migration #1244
Comments
When I changed |
I have the same issue since we upgraded to DBAL 3. In addition to generating a class Invoice
{
#[ORM\Column(type: 'string', length: 50, unique: true)]
protected string $reference;
#[ORM\Column(type: 'string', length: 30)]
protected string $identifier;
#[ORM\Column(name: 'sequence', type: 'string', length: 20, options: ['collation' => 'ascii_bin'])]
protected string $sequence;
} Typical final class Version20220311164758 extends AbstractMigration
{
public function up(Schema $schema): void
{
$this->addSql('
ALTER TABLE Invoice
CHANGE sequence sequence VARCHAR(20) NOT NULL COLLATE `ascii_bin`
');
}
public function down(Schema $schema): void
{
$this->addSql('
ALTER TABLE Invoice
CHANGE reference reference VARCHAR(50) NOT NULL COLLATE `utf8mb4_unicode_ci`,
CHANGE identifier identifier VARCHAR(30) NOT NULL COLLATE `utf8mb4_unicode_ci`,
CHANGE sequence sequence VARCHAR(20) CHARACTER SET ascii NOT NULL COLLATE `ascii_bin`
');
}
} What's really annoying is that executing the migration then running Stack:
Is there a workaround, while waiting for a fix? |
I have same issue, but I meant that issue is in doctrine/dbal -> I explained at here: doctrine/dbal#5322 |
@reinfi @BenMorel please check if doctrine/dbal#5326 fixes your issues. |
@greg0ire @morozov Thanks, but I'm still having an issue using class Invoice
{
#[ORM\Column(name: 'sequence', type: 'string', length: 20, options: ['collation' => 'ascii_bin'])]
protected string $sequence;
} Those still generate diffs. |
@BenMorel could you try reproducing your issue in a form similar to doctrine/dbal#5322? |
Closing, let me know if you still have the issue, folks. |
Fixed thank you! |
@morozov I still have the issue when I created an issue here: doctrine/dbal#5338 (with reproduce project) but is it the right place? Please let me know if you want me to transfer the issue to |
Bug Report
Summary
Diff-Command always generates a down migration which all fields with varchar columns have a change in the collation and charset.
Current behavior
mySQL-Version is 5.7.13 but I have the same issues on a mysql 8 platform.
Given that entity, which has the following sql in the mySQL database
This always generates a down migration with the following sql statement.
The up migration part is always empty.
I could fix this problem by adding the following the my property.
So maybe it is expected but it has changed between versions because this happens only since a few versions.
How to reproduce
Create entity above and execute diff-command will always lead to changes in the down migration part.
Expected behavior
I'm a bit unsure what I would expect. May be it is correct but then I would expect a up migration to fix the issue and remove charset and collation so diff is empty.
The text was updated successfully, but these errors were encountered: