You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When working with indexes in MySQL (maybe in other databases too), there is an index size limit. If there is a string field that is bigger than the index size, Grails doesn't create the index even if it's defined in the mapping.
In MySQL it's possible to define a big varchar, then for the index to be created:
You will notice the index that should contain archetypeId and archetypePath is not created in the database.
Expected Behaviour
There is no problem with the behavior, since the current mapping DSL doesn't allow to specify the size of the index. What I would propose is something like a maxSize on the long field when defining the indexes, because that is the one that causes issues independently of the index or indexes that include the corresponding table column:
When working with indexes in MySQL (maybe in other databases too), there is an index size limit. If there is a string field that is bigger than the index size, Grails doesn't create the index even if it's defined in the mapping.
In MySQL it's possible to define a big varchar, then for the index to be created:
CREATE TABLE t1 (
col1 VARCHAR(10),
col2 VARCHAR(4096),
INDEX (col1, col2(10))
);
Without the size in the index, this error is thrown: Specified key was too long; max key length is 3072 bytes
CREATE TABLE t1 (
col1 VARCHAR(10),
col2 VARCHAR(4096),
INDEX (col1, col2)
);
Though something like that defined as a Grails Domain class would fail silently.
Task List
Steps to Reproduce
Use MySQL as the database.
Define a domain with a big string constraint:
Expected Behaviour
There is no problem with the behavior, since the current mapping DSL doesn't allow to specify the size of the index. What I would propose is something like a maxSize on the long field when defining the indexes, because that is the one that causes issues independently of the index or indexes that include the corresponding table column:
Actual Behaviour
An index size is not supported in the mapping DSL.
Environment Information
Example Application
The text was updated successfully, but these errors were encountered: