I am new to laravel.
I am working on laravel version 6.
I have created migration.
It works nicely the first time, but if i change something in the migration file and then i run php artisan migrate
it shows nothing to migrate
.
I tried php artisan migrate --path
as well but it does not work.
To make it work i have to delete the migration file and create it again.
I don't want to use php artisan migrate:fresh
.
what should i do to run only one migrations file which has been changed?
When you run php artisan migrate
it'll check migration table if there is no new file in the migration folder it'll show you nothing to migrate.
If you want to rollback last migration.
To rollback
the latest migration operation, you may use the rollback command. This command rolls back the last "batch" of migrations, which may include multiple migration files:
php artisan migrate:rollback
It'll delete the last created table.
The migrate:reset
command will roll back all of your application's migrations:
php artisan migrate:reset
The migrate:fresh
command will drop all tables.
php artisan migrate:fresh
php artisan migrate:fresh --seed
more info : document
Sadly impossible. The best workaround is to use seeders and use php artisan db:seed
after you use php artisan migrate:fresh
. Why don't you want to use that?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With