How to Run Migration Under a Folder in Laravel

In Laravel, if you want to use database tables you have to create migrations to make those tables. These migrations files are required to run migration commands to generate tables.Generally this migrations files are found under \Database\Migrations folder but some time if we are developing a project which have multiple sections and these sections may have multiple directory and these directory may have multiple migrations files under it.so following are the command which may run while we have directories under the \Migrations folder.

Assume, i have a directory called “student” under \database\migrations\ and have migration 2014_10_12_000000_create_users_table.php so the full path is \database\migrations\student\2014_10_12_000000_create_users_table.php. You can run this migration in following 2 ways.

Method 1

php artisan migrate --path=\databsase\migrations\student

Method 2

php artisan migrate --path=\databsase\migrations\student\2014_10_12_000000_create_users_table.php

Leave a Comment