Jira issue originally created by user ben.davies:
Not sure if this is Postgresql specific or not, but here are the reproduction steps:
Have a table with a column setup like so:
ALTER TABLE usr ADD COLUMN contact_count integer;
ALTER TABLE usr ALTER COLUMN contact_count SET NOT NULL;
ALTER TABLE usr ALTER COLUMN contact_count SET DEFAULT 0;
Have a Entity Column Definition like so:
* @var integer $contactCount
* @ORM\Column(name="contact_count", type="integer", nullable=false)
private $contactCount = 0;
orm:schema-tool:update will generate the following SQL:
ALTER TABLE usr ALTER contact_count SET ;
to the column definition results in no sql being generated (correctly I assume)
Comment created by @ocramius:
The ORM doesn't support default column values.
That's fine-tuning you can do on the column definitions.
Your "workaround" is actually the correct way of dealing with this kind of DDL change.
Comment created by ben.davies:
I realise the ORM doesn't support default values, but the point is that the schematool picks up a diff in the columns, tries to generate a diff, and generates an invalid sql statement. Surely that is a bug?
[~ben.davies] the DBAL is responsible for generating this wrong DDL... Are you able to reproduce this in DBAL only?
Happy to try.
here you go