Laravel Migrations Naming Convention

Is there a naming convention or guide that should be followed when calling the Laravel migration, or should the name be descriptive enough?

Also, suppose you add 12 columns to modify the table, then in this case the migration name will be too long if descriptive is done, so are there any guiding lines?

+7
php naming-conventions laravel database-migration
source share
2 answers

No one cares about the names of the migration classes. It should be descriptive enough so that you can check and understand what you have done with the database in this migration.

I usually call function-based migration, for example implementation_user_roles or make_employee_profile_editable

+4
source share

Make sure you are not using the same class name with your model, it still works, but for understanding,

Put create_ if you create, for example, or

If the tables are hinges of each other, do it as article_comment to make sure you understand when you try to change it after 5 months :)

+2
source share

All Articles