I have table "invoice_relations" which is morph table. So in migration I wrote :
$table->morphs('invoice_relations');
But it gives error while running migration as,
Syntax error or access violation: 1059 Identifier na
me 'invoice_relations_invoice_relations_id_invoice_relations_type_index' is too long in /var/www/html/st/sales-tantra/vendor/doctrine/dbal/
lib/Doctrine/DBAL/Driver/PDOStatement.php:105
Change your
$table->morphs('invoice_relations');
To this:
$table->morphs('invoice_relations', 'invoice_relations_morpf_key');
Or this:
$table->unsignedInteger("invoice_relations_id");
$table->string("invoice_relations_type");
$table->index(["invoice_relations_id", "invoice_relations_type"], "YOUR_INDEX_NAME");
But I think name for polymorphic relations name ends 'able', for example relationable.
https://laravel.com/docs/5.6/eloquent-relationships#polymorphic-relations
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments