Xethron / migrations-generator

Laravel Migrations Generator: Automatically generate your migrations from an existing database schema.
MIT License
3.32k stars 588 forks source link

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

Open rtorralba opened 7 years ago

rtorralba commented 7 years ago

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.

pmirandaarias commented 6 years ago

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

brunoramonalmeida commented 5 years ago

Anyone?