John Davidson

php - Laravel migrate fresh specific migration

0 comments
Message:


I'm trying to migrate some database tables in my Laravel application. I'm using a third party library https://github.com/spatie/laravel-schedule-monitor which seems to break and requires re-migrating when upgrading. If I run php artisan migrate:fresh locally it'll work just fine, but amongst all of my other migrations I don't want to overwrite and dump the data in my other tables in a production environment.


I want to migrate:fresh a specific migration...


UPDATE


When trying to run the refresh command on a table, the below happens...




My Answer:
To migrate:fresh a specific migration in Laravel, you can use the --path option to specify the path to the specific migration file you want to refresh. Here's how you can do it:

bash
php artisan migrate:fresh --path=/database/migrations/your_specific_migration_file.php


Replace `/database/migrations/your_specific_migration_file.php` with the actual path to your specific migration file.

This command will only refresh the specified migration file and not affect any other tables in your database.

Make sure to backup your database before running this command in a production environment to avoid any data loss.

Rate this post

5 of 5 based on 7909 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us