[DBAL-84] Long string fields are being silently changed to 255 characters in the schema Created: 31/Jan/11  Updated: 20/Feb/11  Resolved: 20/Feb/11

Status: Resolved
Project: Doctrine DBAL
Component/s: Schema Managers
Affects Version/s: 2.0, 2.0.1
Fix Version/s: 2.0.2, 2.1

Type: Bug Priority: Major
Reporter: Oleg Anashkin Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

I have an entity like this:

/**
 * @orm:Entity
 */
class Product
{
    /**
     * @orm:Id
     * @orm:Column(name="Merchant",type="string",length=50)
     */
    protected $merchant;

    /**
     * @orm:Column(name="Name",type="string",length=500)
     */
    protected $name;
}

When I change the length of $name field to 4000 it updates the schema like it is supposed to:

php.exe -f console doctrine:schema:update --dump-sql
ALTER TABLE product CHANGE Name Name VARCHAR(4000) NOT NULL

But when I change the length to 5000 it just silently without any warning uses value 255 instead:

php.exe -f console doctrine:schema:update --dump-sql
ALTER TABLE product CHANGE Name Name VARCHAR(255) NOT NULL

I had to look into actual table definition using mysql browser to find this issue because doctrine doesn't even warn about it. This could lead to some pretty serious bugs!



 Comments   
Comment by Benjamin Eberlei [ 20/Feb/11 ]

Fixed in master and 2.0.x

Generated at Tue Sep 23 16:27:17 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.