Generating Migrations
To create a migration, use the make:migration
Artisan command:
php artisan make:migration create_users_table
The new migration will be placed in your database/migrations
directory. Each migration file name contains a timestamp which allows Laravel to determine the order of the migrations.
The --table
and --create
options may also be used to indicate the name of the table and whether
the migration will be creating a new table. These options pre-fill the
generated migration stub file with the specified table:
php artisan make:migration create_users_table --create=users
php artisan make:migration add_votes_to_users_table --table=users
If you would like to specify a custom output path for the generated migration, you may use the --path
option when executing the make:migration
command. The given path should be relative to your application's base path.