Aslam H
Aslam H

Reputation: 1801

Laravel migrate:refresh Doesn't Work After Composer Update

The command in the title return error message below:

Type error: Too few arguments to function Illuminate\Database\Schema\Builder::create(), 1 passed in C:\xampp7\htdocs\assurance-web\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php on line 221 and exactly 2 expected

I installed the framework with the commands:

composer create-project --prefer-dist laravel/laravel assurance-web
version 5.7

Then executed:

php artisan make:migration create_banks_table --create=banks

I was able to run php artisan migrate with no errors. However, then when I run php artisan migrate:refresh I get the error above.

This is "2018_12_04_033726_create_table_banks.php":

<?php

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

class CreateBanksTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('banks', function(Blueprint $table) {
            $table->increments('id');
            $table->string('bank_name');
            $table->string('bank_code');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('banks');
    }
}

Upvotes: 0

Views: 2799

Answers (1)

robotu
robotu

Reputation: 213

Maybe your migration table is compromised. You can use:

php artisan migrate:fresh

instead of "php artisan migrate:refresh" and the migration will see that it will work.

The "php artisan migrate:fresh" command physically deletes all tables instead of rolling back.

Upvotes: 2

Related Questions