Search code examples
laravellaravel-5migration

Laravel Migrate Specific File(s) from Migrations


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), cause right now every time there is a change I use php artisan migrate:refresh and all fields are getting reset.


Solution

  • 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/