<?php
use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;
class CreateSystemRoleDeptTable extends Migration
{
public function up(): void
{
Schema::create('system_role_dept', function (Blueprint $table) {
$table->engine = 'Innodb';
$table->comment('角色与部门关联表');
$table->addColumn('bigInteger', 'role_id', ['unsigned' => true, 'comment' => '角色主键']);
$table->addColumn('bigInteger', 'dept_id', ['unsigned' => true, 'comment' => '部门主键']);
$table->primary(['role_id', 'dept_id']);
});
}
public function down(): void
{
Schema::dropIfExists('system_role_dept');
}
}