laravel 外键schema RBAC

$table->bigIncrements('id')  ;   Incrementing ID (primary key) using a " UNSIGNED BIG INTEGER" equivalent.

$table->increments('id')

$table->smallIncrements('id')

        Schema::create('roles', function (Blueprint $table) {
$table->tinyInteger('id')->unsigned()->autoIncrement();
$table->string('name');
$table->string('display_name');
}); Schema::create('permissions', function (Blueprint $table) {
$table->smallIncrements('id');
$table->string('name');
$table->string('display_name');
}); Schema::create('permission_role', function (Blueprint $table) {
$table->smallInteger('permission_id')->unsigned();
$table->tinyInteger('role_id')->unsigned();
$table->foreign('permission_id')->references('id')->on('permissions')->onDelete('cascade');
$table->foreign('role_id')->references('id')->on('roles')->onDelete('cascade');
});

smallint  65535
tinyint   255

上一篇:对于使用JDBC连接mysql数据时The server time zone value '¤¤°ê¼Ð·Ç®É¶¡'...的异常问题解决。


下一篇:201521123037 《Java程序设计》第1周学习总结