rlandster
rlandster

Reputation: 7825

symfony Doctrine migration adding boolean column and field length

I have a symfony 1.4 project and I am adding a new column via a migration. The new column in schema.yml looks like this:

has_private_data: { type: boolean, notnull: true, default: false }

The migration that gets generated looks like this:

<?php
/**
 * This class has been auto-generated by the Doctrine ORM Framework
 */
class Version26 extends Doctrine_Migration_Base
{
    public function up()
    {
        $this->addColumn('device', 'has_private_data', 'boolean', '25', array(
             'notnull' => '1',
             'default' => '0',
             ));
        $this->addColumn('device_history', 'has_private_data', 'boolean', '25', array(
             'notnull' => '1',
             'default' => '0',
             ));
    }

    public function down()
    {
        $this->removeColumn('device', 'has_private_data');
        $this->removeColumn('device_history', 'has_private_data');
    }
}

Why it the length of this boolean field being set to 25? (My backend database is MySql.)

Upvotes: 2

Views: 1825

Answers (1)

plandolt
plandolt

Reputation: 1931

You can be save by ignoring that. In doctines Table.php on line 1361 you can find that if the type is booelan the length will be fixed to 1.

            case 'boolean':
                $length = 1;

Upvotes: 1

Related Questions