#1552: createTableSql() does not follow model information
-------------------------+--------------------------------------------------
  Reporter:  _cheerios   |       Owner:  jwage                
      Type:  defect      |      Status:  closed               
  Priority:  minor       |   Milestone:  1.0.4                
 Component:  Attributes  |     Version:  1.0.2                
Resolution:  invalid     |    Keywords:                       
  Has_test:  0           |    Mystatus:  Pending Core Response
 Has_patch:  0           |  
-------------------------+--------------------------------------------------
Changes (by guilhermeblanco):

  * status:  new => closed
  * resolution:  => invalid

Old description:

> {{{
> class Meep extends Doctrine_Record {
>   public function setTableDefinition() {
>     $this->hasColumn('meep_id', 'integer', 4, array('unsigned' => 0,
> 'primary' => false, 'notnull' => true, 'autoincrement' => false));
>     $this->hasColumn('meep_item', 'string', 2048, array('fixed' => false,
> 'primary' => false, 'notnull' => true, 'autoincrement' => false));
>     $this->index('meep_id', array('fields' => array('meep_id')));
>     $this->option('type', 'MYISAM');
>   }
>
>   public function setUp() {
>     parent::setUp();
>   }
> }
>

> $i = new Meep;
> $f = $i->getTable()->getExportableFormat();
>
> $fields = $f['columns'];
> $options = $f['options'];
>
> $ex = new Doctrine_Export;
> var_dump($ex->createTableSql('Meep_Sql',$fields,$options));
> }}}
>
> Got:
> {{{
> CREATE TABLE Meep_Sql (id BIGINT AUTO_INCREMENT, meep_id INT NOT NULL,
> meep_item TEXT NOT NULL, PRIMARY KEY(id), INDEX meep_id (meep_id))
> }}}
>
> '''Expected:'''
> {{{
> CREATE TABLE Meep_Sql (id BIGINT AUTO_INCREMENT, meep_id INT NOT NULL,
> meep_item VARCHAR(2048) NOT NULL, PRIMARY KEY(id), INDEX meep_id
> (meep_id)) ENGINE=MYISAM;
> }}}
>
> For some reason VARCHAR(2048) became TEXT and type information
> (ENGINE=MYISAM) got lost.
>
> From MySQL documentation:
> "Values in VARCHAR columns are variable-length strings. The length can be
> specified as a value from 0 to 255 before MySQL 5.0.3, and 0 to 65,535 in
> 5.0.3 and later versions."

New description:

 {{{
 class Meep extends Doctrine_Record {
   public function setTableDefinition() {
     $this->hasColumn('meep_id', 'integer', 4, array('unsigned' => 0,
 'primary' => false, 'notnull' => true, 'autoincrement' => false));
     $this->hasColumn('meep_item', 'string', 2048, array('fixed' => false,
 'primary' => false, 'notnull' => true, 'autoincrement' => false));
     $this->index('meep_id', array('fields' => array('meep_id')));
     $this->option('type', 'MYISAM');
   }

   public function setUp() {
     parent::setUp();
   }
 }


 $i = new Meep;
 $f = $i->getTable()->getExportableFormat();

 $fields = $f['columns'];
 $options = $f['options'];

 $ex = new Doctrine_Export;
 var_dump($ex->createTableSql('Meep_Sql',$fields,$options));
 }}}

 Got:
 {{{
 CREATE TABLE Meep_Sql (id BIGINT AUTO_INCREMENT, meep_id INT NOT NULL,
 meep_item TEXT NOT NULL, PRIMARY KEY(id), INDEX meep_id (meep_id))
 }}}

 '''Expected:'''
 {{{
 CREATE TABLE Meep_Sql (id BIGINT AUTO_INCREMENT, meep_id INT NOT NULL,
 meep_item VARCHAR(2048) NOT NULL, PRIMARY KEY(id), INDEX meep_id
 (meep_id)) ENGINE=MYISAM;
 }}}

 For some reason VARCHAR(2048) became TEXT and type information
 (ENGINE=MYISAM) got lost.

 From MySQL documentation:
 "Values in VARCHAR columns are variable-length strings. The length can be
 specified as a value from 0 to 255 before MySQL 5.0.3, and 0 to 65,535 in
 5.0.3 and later versions."

Comment:

 You should use Doctrine_Export_MySql if you want to create MySql specific
 SQLs.

 Ticket is invalid.

-- 
Ticket URL: <http://trac.doctrine-project.org/ticket/1552#comment:3>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"doctrine-svn" group.
 To post to this group, send email to [email protected]
 To unsubscribe from this group, send email to [EMAIL PROTECTED]
 For more options, visit this group at 
http://groups.google.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---

Reply via email to