Bug Report
| Q |
A |
| BC Break |
no |
| Version |
2.11.1 |
| Database Server |
docker: mcr.microsoft.com/mssql/server:2019-CU4-ubuntu-16.04 |
| Doctrine Driver |
pdo_sqlsrv |
Summary
When an entity has a column with a comment, I change the type of that column without changing the comment, Doctrine is not correctly finding the comment changes on the column.
I am getting an error
SQLSTATE[42000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Property cannot be added. Property 'MS_Description' already exists for 'dbo.user.surname'.
After changing the column type and updating comments at the same time, it works fine.
Current behaviour
Schema updater tries to add a property that already exists and has not changed.
How to reproduce
- Declare an entity with column with comment or add column with comment.
class User
{
/**
* @ORM\Column(type="integer", nullable=false, options={"comment":"Funky comment"})
*/
private $surname;
}
orm:schema-tool:update --dump-sql output:
CREATE TABLE [user] (id INT IDENTITY NOT NULL, surname INT NOT NULL, PRIMARY KEY (id));
EXEC sp_addextendedproperty N'MS_Description', N'Funky comment', N'SCHEMA', 'dbo', N'TABLE', '[user]', N'COLUMN', surname;
- Change this column type or requirement without changing the comment.
class User
{
/**
* @ORM\Column((type="string", length=100, nullable=true, options={"comment":"Funky comment"})
*/
private $surname;
}
orm:schema-tool:update --dump-sql output:
ALTER TABLE [user] ALTER COLUMN surname NVARCHAR(100);
EXEC sp_addextendedproperty N'MS_Description', N'Funky comment', N'SCHEMA', 'dbo', N'TABLE', 'user', N'COLUMN', surname;
Expected behaviour
The schema updater should only update the column type without updating the comment unless it has changed.
Bug Report
Summary
When an entity has a column with a comment, I change the type of that column without changing the comment, Doctrine is not correctly finding the comment changes on the column.
I am getting an error
After changing the column type and updating comments at the same time, it works fine.
Current behaviour
Schema updater tries to add a property that already exists and has not changed.
How to reproduce
orm:schema-tool:update --dump-sqloutput:orm:schema-tool:update --dump-sqloutput:Expected behaviour
The schema updater should only update the column type without updating the comment unless it has changed.