Doctrine Project

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What’s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
Doctrine 2 - ORM
  • Doctrine 2 - ORM
  • DDC-972

MySql MyISAM support

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Improvement Improvement
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 2.0
  • Fix Version/s: None
  • Component/s: Mapping Drivers
  • Security Level: All
  • Labels:
    None
  • Environment:
    All

Description

We can not set MySql Engine for MyISAM. MySqlPlatform has a _getCreateTableSQL where you can pass some options with the engine param.
Not able to set it up from yml, xml or annotation schema.

Activity

Descending order - Click to sort in ascending order
  • All
  • Comments
  • History
  • Activity
  • Source
Hide
Permalink
Benjamin Eberlei added a comment - 13/Jul/12 9:53 AM

Yes, that is probably what this ticket boils down to

Show
Benjamin Eberlei added a comment - 13/Jul/12 9:53 AM Yes, that is probably what this ticket boils down to
Hide
Permalink
Christophe Coevoet added a comment - 13/Jul/12 8:50 AM

should we add the support of the options for the @JoinTable annotation ?

Show
Christophe Coevoet added a comment - 13/Jul/12 8:50 AM should we add the support of the options for the @JoinTable annotation ?
Hide
Permalink
Benjamin Eberlei added a comment - 13/Jul/12 8:23 AM

You can do all tables as MyISAM already through metadata using @Table(options=

{"engine": "MyISAM"}

) except Many-To-Many Join Tables. But you could create a listener to the "postSchemaGenerate" event and accept the schema instance there, modify everything accordingly.

Show
Benjamin Eberlei added a comment - 13/Jul/12 8:23 AM You can do all tables as MyISAM already through metadata using @Table(options= {"engine": "MyISAM"} ) except Many-To-Many Join Tables. But you could create a listener to the "postSchemaGenerate" event and accept the schema instance there, modify everything accordingly.
Hide
Permalink
gabriel sancho added a comment - 12/Jul/12 1:34 PM

in Doctrine 2.2.2 will be

Doctrine/ORM/Tools/SchemaTool.php-149- /// PATCH ------------------------------------
Doctrine/ORM/Tools/SchemaTool.php-150- if ( isset($class->table["engine"]) )
Doctrine/ORM/Tools/SchemaTool.php-151- $table->addOption("engine",$class->table["engine"]);
Doctrine/ORM/Tools/SchemaTool.php-152- /// PATCH ------------------------------------

Doctrine/ORM/Mapping/ClassMetadataInfo.php-1719- /// PATCH ------------------------------------
Doctrine/ORM/Mapping/ClassMetadataInfo.php-1720- if (isset($table['engine']))

{ Doctrine/ORM/Mapping/ClassMetadataInfo.php-1721- $this->table['engine'] = $table['engine']; Doctrine/ORM/Mapping/ClassMetadataInfo.php-1722- }

Doctrine/ORM/Mapping/ClassMetadataInfo.php-1723- /// PATCH ------------------------------------

Doctrine/ORM/Mapping/Table.php-42- /// PATCH ------------------------------------
Doctrine/ORM/Mapping/Table.php-43- /** @var string */
Doctrine/ORM/Mapping/Table.php-44- public $engine;
Doctrine/ORM/Mapping/Table.php-45- /// PATCH ------------------------------------

Doctrine/ORM/Mapping/Driver/AnnotationDriver.php-181- /// PATCH ------------------------------------
Doctrine/ORM/Mapping/Driver/AnnotationDriver.php-182- $primaryTable['engine'] = $tableAnnot->engine;
Doctrine/ORM/Mapping/Driver/AnnotationDriver.php-183- /// PATCH ------------------------------------

i found a problem in ManyToMany relations, the intermediate table will be InnoDB

Show
gabriel sancho added a comment - 12/Jul/12 1:34 PM in Doctrine 2.2.2 will be Doctrine/ORM/Tools/SchemaTool.php-149- /// PATCH ------------------------------------ Doctrine/ORM/Tools/SchemaTool.php-150- if ( isset($class->table ["engine"] ) ) Doctrine/ORM/Tools/SchemaTool.php-151- $table->addOption("engine",$class->table ["engine"] ); Doctrine/ORM/Tools/SchemaTool.php-152- /// PATCH ------------------------------------ Doctrine/ORM/Mapping/ClassMetadataInfo.php-1719- /// PATCH ------------------------------------ Doctrine/ORM/Mapping/ClassMetadataInfo.php-1720- if (isset($table ['engine'] )) { Doctrine/ORM/Mapping/ClassMetadataInfo.php-1721- $this->table['engine'] = $table['engine']; Doctrine/ORM/Mapping/ClassMetadataInfo.php-1722- } Doctrine/ORM/Mapping/ClassMetadataInfo.php-1723- /// PATCH ------------------------------------ Doctrine/ORM/Mapping/Table.php-42- /// PATCH ------------------------------------ Doctrine/ORM/Mapping/Table.php-43- /** @var string */ Doctrine/ORM/Mapping/Table.php-44- public $engine; Doctrine/ORM/Mapping/Table.php-45- /// PATCH ------------------------------------ Doctrine/ORM/Mapping/Driver/AnnotationDriver.php-181- /// PATCH ------------------------------------ Doctrine/ORM/Mapping/Driver/AnnotationDriver.php-182- $primaryTable ['engine'] = $tableAnnot->engine; Doctrine/ORM/Mapping/Driver/AnnotationDriver.php-183- /// PATCH ------------------------------------ i found a problem in ManyToMany relations, the intermediate table will be InnoDB
Hide
Permalink
Cédric Tailly added a comment - 19/May/11 10:55 AM

I have the same problem and I didn't found documentation to select the engine for a given table.

I tried to understand the code by myself and made modifications of my Doctrine v2.0.5, perhaps this is not the best one but here is a beginning of a solution :

-------------------------------------------------------------------------------

@ ORM\Mapping\Driver\DoctrineAnnotations.php:100

final class Table extends Annotation

{ public $name; public $schema; public $indexes; public $uniqueConstraints; public $engine; }

@ ORM\Mapping\Driver\AnnotationDriver.php:144

$primaryTable = array(
'name' => $tableAnnot->name,
'schema' => $tableAnnot->schema,
'engine' => $tableAnnot->engine
);

@ ORM\Tools\SchemaTool.php:133

$table = $schema->createTable($class->getQuotedTableName($this->_platform));

if ( isset($class->table["engine"]) )
$table->addOption("engine",$class->table["engine"]);

-------------------------------------------------------------------------------

...and to define for instance the MyISAM engine in annotations :

/**

  • @Entity
  • @Table(engine="MyISAM")
    */

Because there is no foreign key on MyISAM tables, there are still problems on the schema creation/update when Doctrine executes the corresponding "alter table" SQL commands.

Show
Cédric Tailly added a comment - 19/May/11 10:55 AM I have the same problem and I didn't found documentation to select the engine for a given table. I tried to understand the code by myself and made modifications of my Doctrine v2.0.5, perhaps this is not the best one but here is a beginning of a solution : ------------------------------------------------------------------------------- @ ORM\Mapping\Driver\DoctrineAnnotations.php:100 final class Table extends Annotation { public $name; public $schema; public $indexes; public $uniqueConstraints; public $engine; } @ ORM\Mapping\Driver\AnnotationDriver.php:144 $primaryTable = array( 'name' => $tableAnnot->name, 'schema' => $tableAnnot->schema, 'engine' => $tableAnnot->engine ); @ ORM\Tools\SchemaTool.php:133 $table = $schema->createTable($class->getQuotedTableName($this->_platform)); if ( isset($class->table ["engine"] ) ) $table->addOption("engine",$class->table ["engine"] ); ------------------------------------------------------------------------------- ...and to define for instance the MyISAM engine in annotations : /** @Entity @Table(engine="MyISAM") */ Because there is no foreign key on MyISAM tables, there are still problems on the schema creation/update when Doctrine executes the corresponding "alter table" SQL commands.

People

  • Assignee:
    Benjamin Eberlei
    Reporter:
    nicolas isnardi
Vote (2)
Watch (6)

Dates

  • Created:
    07/Jan/11 6:25 PM
    Updated:
    13/Jul/12 9:53 AM
  • Atlassian JIRA (v5.2.7#850-sha1:b2af0c8)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Doctrine Project. Try JIRA - bug tracking software for your team.