Laravel database migration reports an error.
Use the migrate: make command of the Artisan command line to create a migration: (use in command line mode)
php artisan migrate:make create_users_table
All the migration files are stored in the app/database/migrations folder. the files are named with timestamps to facilitate the Laravel framework to define the order of these files by time.
You can use the -- path option during migration creation to specify the path for storing the migration file. This path is the relative path of the root directory of your installation framework:
php artisan migrate:make foo --path=app/migrations
The -- table and -- create options are used to specify the table name and whether to create a new table:
php artisan migrate:make add_votes_to_user_table --table=usersphp artisan migrate:make create_users_table --create=users
Run data migration run all migration (keep all your tables up-to-date)
php artisan migrate
Run all migration under a path (specify the path of the migration file)
php artisan migrate --path=app/foo/migrations
Run all the migrations under a certain package (used to install or upgrade the corresponding database of an extension package)
php artisan migrate --package=vendor/package
Note:If you receive a "class not found" error while running the migration, try to run the composer dump-autoload command.
Use data migration forcibly in the production environment
Some migration operations are destructive and may cause you to lose the original data in the database. to prevent unnecessary damages caused by running such commands, you are asked whether you are sure to do so. if you want to run such a command without a prompt, you can use the -- force option:
php artisan migrate --force
Rollback data migration (even if rollback is performed, the original data is damaged and only the table structure can be rolled back. therefore, do not use this function as a life-saving tool). rollback the last Migration
php artisan migrate:rollback
Don't worry: run composer dump-autoload
Try again, OK. see the figure below.
Roll back all migration
php artisan migrate:reset
Roll back all migration and re-run data migration
php artisan migrate:refreshphp artisan migrate:refresh --seed