hasTable('admin_role_department'); if (!$exists) { $table = $this->table('admin_role_department', ['comment' => '角色数据权限部门关联表']); $table->addColumn('role_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR, 'null' => false, 'default' => 0, 'comment' => '角色id']) ->addColumn('department_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR, 'null' => false, 'default' => 0, 'comment' => '渠道/部门id']) ->addColumn('created_at', 'datetime', ['comment' => '创建时间']) ->addColumn('updated_at', 'datetime', ['comment' => '更新时间']) ->create(); } } }