Propel icon indicating copy to clipboard operation
Propel copied to clipboard

Migrations create uncessary ALTER TABLE statements when sqlType="" used in schema

Open exptom opened this issue 11 years ago • 3 comments

I am using sqlType="INTEGER UNSIGNED" on a number of columns in a MySQL database. When I run the diff propel creates an ALTER TABLE statement for every column that has an sqlType="" defined.

e.g. The getUpSQL() has lots of: ALTER TABLE Bookings CHANGE id id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT;

and the getDownSQL() has lots of: ALTER TABLE Bookings CHANGE id id int(10) unsigned NOT NULL AUTO_INCREMENT;

This happens every time I run a diff. e.g. diff, migrate (changes are applied), diff (same set of alter table statements are generated).

Happens on both Propel 1.6.9 and 1.7.0

exptom avatar Jan 08 '14 14:01 exptom

Just discovered I get exactly the same problem with a varbinary column:

schema.xml <column phpNamingMethod="nochange" name="valueBinary" type="varbinary" required="false"/>

getUpSQL: ALTER TABLE Settings CHANGE valueBinary valueBinary MEDIUMBLOB;

getDownSQL: ALTER TABLE Settings CHANGE valueBinary valueBinary LONGBLOB;

exptom avatar Jan 08 '14 15:01 exptom

@exptom Did you got a workaround for this? It's very annoying.

armezit avatar Nov 02 '15 23:11 armezit

No, we have just been removing the unnecessary SQL from the migration each time.

exptom avatar Nov 03 '15 08:11 exptom