Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify folder for laravel migrations?

I am trying to put laravel database migrations in sub folders, but not sure how to do this.

like image 293
Veljko Sirovljević Avatar asked Mar 06 '19 08:03

Veljko Sirovljević


People also ask

Where is migration folder in Laravel?

All migration files are located at database/migrations in the app's root folder. For more detailed information on database migrations, please refer to our guide on How To Use Database Migrations and Seeders to Abstract Database Setup in Laravel.

How do I run a specific migration in Laravel?

To run the specific migration in Laravel, you need to use --path option with the php artisan migrate command. Let's take a simple example, we have '2019_12_04_131405_create_payments_table. php' migration in the database/migrations directory and we would like to run this migration.

How do I relocate to Laravel?

IF you want to re-migrate all the database, you can simply do: php artisan migrate:refresh . IF you want to make sure your database to be clean with your latest changes, you can drop your entire database tables and do php artisan migrate again. Also, you can try php artisan migrate --seed if you have any seeder.


1 Answers

When creating new migrations and executing your migrations, you can pass in a path parameter through the command line interface to specify the directory it will use to create and run the migrations respectively.

php artisan make:migration create_users_table --path=/path/to/your/migration/directory

php artisan migrate --path=/path/to/your/migration/directory
like image 129
Liam Hammett Avatar answered Sep 22 '22 03:09

Liam Hammett