How to create a migration file in specific folder

If we create custom modules, we might need to create migration files in our specific folder.

Patrick Wan
1 min readJan 2, 2023

In this article, I will share a tips to create migration file in specific folder.

Assuming you are using Laravel (5,6,7,8,9), you can create a migration file in a specific folder by doing the following:

1. Create a new folder in your project’s root directory and name it “migrations”.

2. In your terminal, navigate to your project’s root directory and run the following command:

php artisan make:migration create_examples_table — path=your_path

3. This will create a new file in your “migrations” folder. The file will be named something like “2018_01_01_000000_create_[name_of_your_table]_table.php”.

4. In this file, you will define the structure of your table.

5. Once you have defined your table’s structure, you can run the migration by running the following command in your terminal:

php artisan migrate

--

--

Patrick Wan

My name’s Patrick. I’m a Software Developer, experience in Laravel, Vue Js, React Js, Livewire, Jquery, Codegniter, NPM, GIT. I have 5 years plus experience.