Laravel 5.4 Specific Table Migration

前端 未结 21 1518
梦如初夏
梦如初夏 2020-12-07 10:38

Hi read all the included documentation here in https://laravel.com/docs/5.4/migrations.

Is there a way on how to migrate a certain migration file (1 migration only),

21条回答
  •  天涯浪人
    2020-12-07 11:02

    First you should create one migration file for your table like:

    public function up()
        {
            Schema::create('test', function (Blueprint $table) {
                $table->increments('id');
                $table->string('fname',255);
                $table->string('lname',255);
                $table->rememberToken();
                $table->timestamps();
            });
        }
    

    After create test folder in migrations folder then newly created migration moved/copied in test folder and run below command in your terminal/cmd like:

    php artisan migrate --path=/database/migrations/test/
    

提交回复
热议问题