我在使用laravel迁移时遇到问题,我在laravel迁移文件中有tqo interger, 当我尝试迁移它时报告我错误说迁移包含2个主键。 有没有人对此有任何想法。帮助将不胜感激。
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateLoginTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up(){
Schema::create('login', function(Blueprint $table)
{
$table->engine ='InnoDB';
$table->increments('id');
$table->string ('email', 255);
$table->string ('username', 255);
$table->string ('password', 255);
$table->string ('password_temp', 255);
$table->string ('code', 255);
$table->integer ('active', 11);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('login');
}
}
答案 0 :(得分:1)
整数列的调用没有长度(不像纯mysql那样)。所以就这样称呼:
$table->integer ('active');