Skip to content

Loading…

DDC-2802: Mysql index length cannot be specified #3553

Closed
doctrinebot opened this Issue · 4 comments

2 participants

@doctrinebot

Jira issue originally created by user velosipedist:

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.

@doctrinebot

Comment created by velosipedist:

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.

@doctrinebot

Comment created by @beberlei:

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

@doctrinebot

Issue was closed with resolution "Won't Fix"

@doctrinebot

Comment created by jesse.schalken:

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

@beberlei beberlei was assigned by doctrinebot
@doctrinebot doctrinebot closed this
@doctrinebot doctrinebot added the Bug label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.