Php 迁移laravel 5.1中的外键错误

Php 迁移laravel 5.1中的外键错误,php,foreign-keys,laravel-5.1,mysql-error-1064,Php,Foreign Keys,Laravel 5.1,Mysql Error 1064,我已经迁移了这个代码 public function up() { Schema::create('TechnicianGroup', function(Blueprint $table){ $table->increments('id')->unsigned(); $table->string('name', 255); $table->string('description', 64); $ta

我已经迁移了这个代码

 public function up()
{
    Schema::create('TechnicianGroup', function(Blueprint $table){
        $table->increments('id')->unsigned();
        $table->string('name', 255);
        $table->string('description', 64);
        $table->string('token', 255);
        $table->timestamps();
    });
    Schema::create('Site', function(Blueprint $table){
        $table->increments('id');
        $table->string('name', 255);
        $table->string('token', 255);
        $table->timestamps();
    });
    Schema::create('technician', function (Blueprint $table) {
        $table->increments('id');
        $table->string('name', 50);
        $table->string('username', 50);
        $table->string('password', 255);
        $table->string('email', 255);
        $table->string('mobile', 11);
        $table->string('avatar_url', 256);
        $table->string('job_title', 100);
        $table->integer('site_id');
        $table->foreign('site_id')->references('id')->on('site')->onDelete('cascade');
        $table->integer('group_id');
        $table->boolean('is_active');
        $table->string('token', 255);
        $table->timestamps();
    });

}
当我执行任务时

php artisan migrate
结果是

[照亮\数据库\查询异常] SQLSTATE[HY000]:一般错误:1005无法创建表“支持”。#sql-a3c_140'(错误号:150)(sql:alter table
TECHNITOR
add constraint TECHNITOR\u site\u id\u外键(
site\u id
)参考 ces
site
id
) [例外情况] SQLSTATE[HY000]:一般错误:1005无法创建表“支持”。#sql-a3c_140(错误号:150)


您忘了使用
unsigned()
。如果不使用
unsinged()
,则列将为
int(11)
,但您需要
int(10)

site.id
technology.site\u id
必须是相同的类型:int(10)

试试这个:

$table->foreign('site_id')->unsigned()->references('id')->on('site')->onDelete('cascade');