How to use Migration in Laravel Framework


Laravel Migration is a version controlling system for the database. Migration helps developers to modify the database and share it across a platform. This is an integral part of the Laravel web

development. You can easily alter database schema and track record of every update using Migration. This tutorial teaches you how to use migration in the Laravel framework.

Step 1:

To create new migration, run the following command: 

php artisan migrate:make create_users_table 

You will find your migration file inside the application/migrations directory.

Step 2:

Create table schema in the up() method of this file.

 public  function up(){ 

       Schema::create(‘users’, function (Blueprint $table){ 








Step 3:

To execute all the migrations, run: php artisan migrate 

Laravel allows you to rollback previous migrations you’ve made.

To rollback the last migration, run: php artisan migrate:rollback

If migration does not rollback automatically, then run: php artisan migrate:reset

You can run specific migration using this command:

 php artisan migrate –path=/database/migrations/my_migration.php


This tutorial shed some light on Laravel Migration and how you can use it in your project. Migrations might seem like an additional task at first; but when you understand it thoroughly, migrations will provide great help to track your database updates. 

If you are looking for a software firm to create your business website or mobile app, your search ends here. We build affordable and robust software solutions for businesses to digitally thrive on. Contact us to get a quote. You can mail us at [email protected] or WhatsApp us on +91 95 37 84 38 39.