My Laravel migration is like below
public function up()
{
Schema::create('account_main', function (Blueprint $table) {
$table->increments('user_sn')->primary();
$table->string('member_username', 20);
$table->string('login_password', 255);
$table->integer('login_count')->default('0')->unsigned();
});
}
When I ran php artisan migrate, it shows the following error:
1068 Multiple primary key
Could someone help to find the problem?
In
Laravel Eloquent ORMthe typeincrementswill be defined asprimary keyautomatically. So don't need to useprimary()method.If the column is integer.
If the column is string
If you want any other column to be unique (instead of primary key)