migrations-generator icon indicating copy to clipboard operation
migrations-generator copied to clipboard

Identifier name 'table_field_1_field_2...field_n_primary' is too long

Open rtorralba opened this issue 8 years ago • 2 comments

Hi,

When we have a primary key with multiple fields, because the migration try to make the name of this index joining (implode) all fields name, fails for too long identifier name.

Syntax error or access violation: Identifier name 'table_field_1_field_2...field_n_primary' is too long

Maybe the code should check the identifier size, cut it and add some random value at the end in this case.

I will make a pull request with the fix.

rtorralba avatar Feb 28 '17 15:02 rtorralba

Any news on this? I have this error when I try to migrate:

In Connection.php line 647:

SQLSTATE[42000]: Syntax error or access violation: 1059 Identifier name 'formula_ecuaciones_variables_formula_variables_id_formulavariable_formula_ecuaciones_id_formulaecuac' is too long (SQL: alter table formu la_ecuaciones_variables add primary key formula_ecuaciones_variables_formula_variables_id_formulavariable_formula_ecuaciones_id_formulaecuaciones_primary(formula_variables_id_formulavariable, formula_ecuac iones_id_formulaecuaciones))

In PDOStatement.php line 107:

SQLSTATE[42000]: Syntax error or access violation: 1059 Identifier name 'formula_ecuaciones_variables_formula_variables_id_formulavariable_formula_ecuaciones_id_formulaecuac' is too long

In PDOStatement.php line 105:

SQLSTATE[42000]: Syntax error or access violation: 1059 Identifier name 'formula_ecuaciones_variables_formula_variables_id_formulavariable_formula_ecuaciones_id_formulaecuac' is too long

pmirandaarias avatar May 23 '18 22:05 pmirandaarias

Anyone?

brunoramonalmeida avatar Dec 07 '18 18:12 brunoramonalmeida