Is there a naming pattern for table index names in Mysql?

2

This question seems simple, but wanted to know how to set a pattern. Normally using the Mysql Workbench a default is automatically set, as in the example below:

fk_tabela1_tabela2_idx

Note: I'm using Laravel which has nomenclature standards for tables, but I could not find anything about indexes.

    
asked by anonymous 22.08.2017 / 18:38

1 answer

1

For example, let's say you have a posts table that has a user's id in the user_id field as the foreign key. Your foreign key would be:

posts_user_id_foreign // [table]_[columns]_[indextype]

You can find more about this in class Illuminate\Database\Schema\Blueprint in this link , search for the foreign() method on line 395.

    
23.08.2017 / 18:54