SQLSTATE [42000]: syntax error or access violation: default character set 1064 utf8 collate utf8_unicode_ci 'on line 1

I am trying to port this code to mysql database but keep getting this error message.

SQLSTATE [42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual corresponding to MySQL server version for correct syntax to use near ') default character set utf8 collate utf8_unicode_ci' on line 1

public function up()
    {
        Schema::create('user', function(Blueprint $table)
        {
            $table->engine = 'InnoDB';
            $table->increments('id');
            $table->string('name');
            $table->string('email')->unique();
            $table->string('password', 60);
            $table->rememberToken();
            $table->timestamps();
            $table->integer('projectId')->unsigned();
            $table->boolean('isStudent');
            $table->boolean('isCompany');
            $table->String('img');
        });

        Schema::create('user', function($table)
        {
            $table->foreign('projectId')->references('id')->on('project');

        });


    }

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

      

+3


source to share


1 answer


In the second case use Schema::table

For more information see here: fooobar.com/questions/1211187 / ...



public function up()
    {
        Schema::create('user', function(Blueprint $table)
        {
            $table->engine = 'InnoDB';
            $table->increments('id');
            $table->string('name');
            $table->string('email')->unique();
            $table->string('password', 60);
            $table->rememberToken();
            $table->timestamps();
            $table->integer('projectId')->unsigned();
            $table->boolean('isStudent');
            $table->boolean('isCompany');
            $table->string('img');

            $table->foreign('projectId')->references('id')->on('project')->onDelete('cascade');

        });


    }

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

      

+2


source







All Articles