How to Create Table Migration in Laravel 9?

 | Published By: Admin | Published On: May 13, 2022 | Category: Laravel 9

Hi Guys,

In this example, I will learn how to create table migration in laravel can easily and simply create table migration in laravel 9. you will learn laravel 9 to create a table using migration. you will do the following things to create a table in laravel 9 using migration.

I will also let you know how to run migration and rollback migration and how to create migration using a command in laravel 9. let's see the below instruction.

Step 1: Download Laravel

Let us begin the tutorial by installing a new laravel application. if you have already created the project, then skip the following step.

composer create-project laravel/laravel example-app
Step 2: Create Migration

Using the below command you can simply create migration for a database table.

php artisan make:migration create_posts_table

After run the above command, you can see created new file as below and you have to add a new column for string, integer, timestamp, and text data type as like below:


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

class CreatePostTable extends Migration
     * Run the migrations.
     * @return void
    public function up()
        Schema::create('posts', function (Blueprint $table) {

     * Reverse the migrations.
     * @return void
    public function down()
Step 3: Run Migration:

Using the below command we can run our migration and create a database table.

php artisan migrate
Step 4: Migration Rollback:
php artisan migrate:rollback

It will help you...