Laravel 10 Migrate Specific Migration File Tutorial

Reading Time: 3 minutes

The migration system in Laravel 10 is a sophisticated tool for managing and version controlling database schema changes. While performing all migrations is the most usual way, there may be times when you only need to migrate select migration files for testing or to make changes to your database.

This article will walk you through the process of migrating particular migration files in Laravel 10. We’ll look at Laravel’s Artisan command-line interface and show how to precisely execute specific migration files.

Read More: Best Pokemon ROM Hacks 2023 Guide

Let’s get started

Laravel Installation

Open terminal and run this command to create a laravel project.

composer create-project laravel/laravel myblog

It will create a project folder with name myblog inside your local system.

To start the development server of laravel –

php artisan serve


Assuming laravel already installed inside your system.

Create Database & Connect

To create a database, either we can create via Manual tool of PhpMyadmin or by means of a mysql command.

CREATE DATABASE laravel_app;

To connect database with application, Open .env file from application root. Search for DB_ and update your details.


Read More: Laravel 10 How To Store Log Of Eloquent SQL Queries

Create Migration

By default after fresh installation of laravel, you should see 3 default migration files into /database/migrations folder.

To create new migration file,

Open project into terminal and run this command.

$ php artisan make:migration create_products_table

It will create a migration file with name like 2023_07_30_043732_create_products_table.php inside /database/migrations folder.

Open migration file and write this complete code.


use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
     * Run the migrations.
    public function up(): void
        Schema::create('products', function (Blueprint $table) {
            $table->string("title", 120);
            $table->string("prouduct_thumbnail", 170)->nullable();

     * Reverse the migrations.
    public function down(): void


Migrate Migrations in Laravel

Using Migrate, we create table structures into database. We have artisan command to migrate laravel migration files.

Read More: Roblox Unblocked: The Ultimate Gaming Platform for Everyone

Migrate All Migrations

$ php artisan migrate

It will migrate all migrations from /database/migrations folder create their respective tables.

Migrate a Specific Migration File

To Migrate a specific migration file,


$ php artisan migrate:refresh --path=<MIGRATION FILE PATH>


$ php artisan migrate:refresh --path=database/migrations/2023_07_30_043732_create_products_table.php

Inside this case, migration file path is /database/migrations/2023_07_30_043732_create_products_table.php

We hope this article helped you to learn about Laravel 10 Migrate Specific Migration File Tutorial Example in a very detailed way.

Read More: Laravel Send Push Notification to IOS Using Firebase

Online Web Tutor invites you to try Skillshike! Learn CakePHP, Laravel, CodeIgniter, Node Js, MySQL, Authentication, RESTful Web Services, etc into a depth level. Master the Coding Skills to Become an Expert in PHP Web Development. So, Search your favourite course and enroll now.

If you liked this article, then please subscribe to our YouTube Channel for PHP & it’s framework, WordPress, Node Js video tutorials. You can also find us on Twitter and Facebook.

Sanjay KumarHello friends, I am Sanjay Kumar a Web Developer by profession. Additionally I'm also a Blogger, Youtuber by Passion. I founded Online Web Tutor and Skillshike platforms. By using these platforms I am sharing the valuable knowledge of Programming, Tips and Tricks, Programming Standards and more what I have with you all. Read more