Laravel

Migrate specific table/migration file in Laravel

Share your learning

Sometimes we need to migrate only a specific table/migration file but our command is for all migrations. We can use the php artisan migrate command to migrate specific file with particular command flags.

Create the migration file

First of all, let’s create a migration file with the below given artisan command.

php artisan make:migration create_example_table

It will add the new migration file to the database/migrations directory. Now we want to run this specific migration.

Example of migrate specific migration file

If we just use the php artisan migrate command then it will run all the migrations in the path database/migrations. So, we have to run the migrate command on a specific path with the migration file name included.

php artisan migrate –path=/database/migration/dateString_create_tableName_table.php

As we can see in the above artisan command, we just need to declare the –path for the migration. Then It will only find one migration and migrate it successfully.

Hope you found it useful. See you in the next quick help.

Satpal

Recent Posts

How to Switch PHP Versions in XAMPP Easily: Managing Multiple PHP Versions on Ubuntu

Today we are going to learn about managing multiple PHP versions on ubuntu with xampp.…

1 year ago

How to Use Coding to Improve Your Website’s SEO Ranking?

Let's understand about how to use coding to improve your website's SEO. In today’s computerized…

1 year ago

Most Important Linux Commands for Web Developers

Let's understand the most important linux commands for web developers. Linux, as an open-source and…

1 year ago

Top 75+ Laravel Interview Questions Asked by Top MNCs

Today we are going to discuss top 75+ Laravel interview questions asked by top MNCs.Laravel,…

1 year ago

Mailtrap Integration for Email Testing with Laravel 10

Today we will discuss about the Mailtrap integration with laravel 10 .Sending and receiving emails…

1 year ago

Firebase Cloud Messaging (FCM) with Ionic 6: Push Notifications

Today we are going to integrate FCM (Firebase Cloud Messaging) push notifications with ionic application.Firebase…

1 year ago