Running one specific Laravel migration (single file) Running one specific Laravel migration (single file) laravel laravel

Running one specific Laravel migration (single file)


Looks like you're doing it wrong.

Migrations were made to be executed by Laravel one by one, in the exact order they were created, so it can keep track of execution and order of execution. That way Laravel will be able to SAFELY rollback a batch of migrations, without risking breaking your database.

Giving the user the power to execute them manually, make it impossible to know (for sure) how to rollback changes in your database.

If your really need to execute something in your database, you better create a DDL script and manually execute it on your webserver.

Or just create a new migration and execute it using artisan.

EDIT:

If you need to run it first, you need to create it first.

If you just need to reorder them, rename the file to be the first. Migrations are created with a timestemp:

2013_01_20_221554_table

To create a new migration before this one you can name it

2013_01_19_221554_myFirstMigration


You can put migrations in more folders and run something like:

php artisan migrate --path=/app/database/migrations/my_migrations


Just move the already run migrations out of the app/config/database/migrations/ folder . Then run the command php artisan migrate . Worked like a charm for me .