propelorm / Propel

Current stable (and outdated and unmaintained) version of Propel - Please use v2 https://github.com/propelorm/Propel2 --
http://www.propelorm.org
MIT License
841 stars 417 forks source link

integer(4) is not valid in some database systems #336

Open c33s opened 12 years ago

c33s commented 12 years ago

for postgres it is not valid to use integer(x) http://www.postgresql.org/docs/8.1/static/datatype.html#DATATYPE-NUMERIC postgres maps all integers to a own name.

propel converts

<column name="id" phpName="Id" type="INTEGER" size="4" ...

to a

 ...
... integer(4) ....
...

which fails with postgres.

as far as i reserched it is also invalid for ansi sql. https://en.wikipedia.org/wiki/SQL

would be good if it would be converted to a regular integer for postgres (or maybe for all databases, as far as i know mysql is fine with smallint, integer and bigint is it?.

willdurand commented 12 years ago

If it's true, then you just have to add a new rule to this class: https://github.com/propelorm/Propel/blob/master/generator/lib/platform/PgsqlPlatform.php using the PropelTypes::INTEGER constant.

@themouette do you use INTEGER types in your schema?

willdurand commented 12 years ago

@themouette again..