-
-
Notifications
You must be signed in to change notification settings - Fork 397
Open
Description
Bug Report
| Q | A |
|---|---|
| BC Break | no |
| Version | 3.9.4 |
Summary
I have a column for the last update in a table, for which I have set a column definition. Now it seems like because of that column definition some SQL in the migrations is generated when using the doctrine:migrations:diff command, even if the database schema is already in the correct state.
Current behavior
New migration SQL is created even if there should be no changes. At least that's what's happening when using MySQL 5.7.
How to reproduce
- Create a custom schema with a column definition like the following:
$table->addColumn(
Column::editor()
->setUnquotedName('updated_at')
->setTypeName('datetime')
->setColumnDefinition('DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL')
->create(),
);- Run the
bin/console doctrine:migrations:diffcommand - Update your database schema using
bin/console doctrine:migrations:migrate - Run the
bin/console doctrine:migrations:diffcommand again - You'll end up with two migrations, whereby the second contains a line like the following:
ALTER TABLE table CHANGE updated_at updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULLExpected behavior
After the previous steps there should only be one migrations file, because there are no changes to apply.
Metadata
Metadata
Assignees
Labels
No labels