且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将外键添加到现有表Laravel 4中

更新时间:2023-12-01 08:25:04

外键需要未签名: http://laravel.com/docs/schema#foreign-keys

将远程表的密钥更改为未签名

Change the key of the remote table to unsigned

public function up() {
Schema::create('clases_inventario', function($t) {
            $t->increments('id');
            $t->integer('grupos_inventario_id')->unsigned();
            $t->integer('laboratorio_id');
            $t->string('codigo', 4);
            $t->string('descripcion', 64);
            $t->boolean('estado')->default(true);
            $t->timestamps();
        });
}