Reputation: 1776
I have an entity with field $usedMB
. I'm using Doctrine2 as ORM and DoctrineMigrationsBundle for DB migrations.
/**
* @ORM\Entity
*/
class DeviceStatus
{
...
/**
* @ORM\Column(type="float", nullable=true, options={"unsigned":true})
*/
private $usedMB;
...
}
If I execute command php bin/console doctrine:migrations:diff
, I get the following line in the migrations file:
ALTER TABLE device_status CHANGE used_mb used_mb DOUBLE PRECISION DEFAULT NULL
After that, I execute command php bin/console doctrine:migrations:migrate
, and I get the message that migration executed successfully.
But the problem is - if I execute php bin/console doctrine:migrations:diff
again, I get the same line in the migrations file:
ALTER TABLE device_status CHANGE used_mb used_mb DOUBLE PRECISION DEFAULT NULL
Just to point out - no code changes were made between executing commands.
After that, I execute command php bin/console doctrine:migrations:migrate, and again - I get the message that migration executed successfully. And that could go on forever.
This is how concrete field in DB looks:
Can some please explain me why is the same migration generated every time?
Upvotes: 5
Views: 2088
Reputation: 2436
The problem is a bug handling the "unsigned" option with doctrine itself.
Currently theres an open bug report for this topic in the respository: https://github.com/doctrine/dbal/issues/2380
The fix should be released with v2.6
Upvotes: 2