Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2802

Mysql index length cannot be specified

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.3.4
    • Fix Version/s: None
    • Component/s: Mapping Drivers
    • Security Level: All
    • Labels:
    • Environment:
      MS Windows 8, php 5.4

      Description

      MySQL don't allow creating indexes on BLOB/TEXT columns without speciifed size.

      Trying to create index:

      // colname is LONGTEXT
      $tableScheme->addUniqueIndex(['colname'], 'index_name');

      MySQL throws
      > Syntax error or access violation: 1170 BLOB/TEXT column 'colname' used in key specification without a key length

      I can suggest to improve parsing add*Index $columnNames params, for allowing per-column index size definition:

      $tableScheme->addUniqueIndex(['colname(64)'], 'index_name');

      It can be used not just in described case.

        Activity

        Hide
        Nikolay Konev added a comment -

        It matters, because indices definitions are part of tbale creating f.e. in MySQL.

        For now it disallows to create table in one query.

        Working on solution in forked repo now.

        Show
        Nikolay Konev added a comment - It matters, because indices definitions are part of tbale creating f.e. in MySQL. For now it disallows to create table in one query. Working on solution in forked repo now.
        Hide
        Benjamin Eberlei added a comment -

        This is too specific a schema feature. Use EventListener to listen to events triggered from the MySQLPlatform to update the SQL accordingly.

        Show
        Benjamin Eberlei added a comment - This is too specific a schema feature. Use EventListener to listen to events triggered from the MySQLPlatform to update the SQL accordingly.
        Hide
        Jesse Schalken added a comment -

        Is it possible to get more information on how to solve this issue? Do I have to generate the CREATE TABLE statement myself? How does the ORM manage to apply indexes to text/string columns?

        Thanks

        Show
        Jesse Schalken added a comment - Is it possible to get more information on how to solve this issue? Do I have to generate the CREATE TABLE statement myself? How does the ORM manage to apply indexes to text/string columns? Thanks

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Nikolay Konev
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: