Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.2
    • 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

        Hide
        Benjamin Eberlei added a comment -

        This was added in 2.2 or 2.3 with

        @Table(options={"engine":"MyISAM"}) 
        Show
        Benjamin Eberlei added a comment - This was added in 2.2 or 2.3 with @Table(options={ "engine" : "MyISAM" })
        Hide
        Benjamin Eberlei added a comment -

        Yes, that is probably what this ticket boils down to

        Show
        Benjamin Eberlei added a comment - Yes, that is probably what this ticket boils down to
        Hide
        Christophe Coevoet added a comment -

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

        Show
        Christophe Coevoet added a comment - should we add the support of the options for the @JoinTable annotation ?
        Hide
        Benjamin Eberlei added a comment -

        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 - 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
        gabriel sancho added a comment -

        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 - 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
        Cédric Tailly added a comment - - edited

        I have the same problem and I didn't find 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 - - edited I have the same problem and I didn't find 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
          • Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: