php - SQLSTATE[42000]: Syntax error or access violation: 1064 default character set utf8 collate utf8_unicode_ci' at line 1 -


i'm trying migrate code mysql database keep getting error message.

sqlstate[42000]: syntax error or access violation: 1064 have error in sql syntax; check manual corresponds mysql server version right syntax use near ') default character set utf8 collate utf8_unicode_ci' @ 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 migrations.      *      * @return void      */     public function down()     {         schema::drop('user');     } } 

for second instance, use schema::table

for more information, see here: https://stackoverflow.com/a/28007930/938664

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 migrations.      *      * @return void      */     public function down()     {         schema::drop('user');     } } 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -