初始化
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Db\Adapter\MysqlAdapter;
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class CreateAdminRolePermissions extends AbstractMigration
|
||||
{
|
||||
/**
|
||||
* Change Method.
|
||||
*
|
||||
* Write your reversible migrations using this method.
|
||||
*
|
||||
* More information on writing migrations is available here:
|
||||
* https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
|
||||
*
|
||||
* Remember to call "create()" or "update()" and NOT "save()" when working
|
||||
* with the Table class.
|
||||
*/
|
||||
public function change(): void
|
||||
{
|
||||
$exists = $this->hasTable('admin_role_permissions');
|
||||
if (!$exists) {
|
||||
$table = $this->table('admin_role_permissions', ['comment' => '系统角色权限表']);
|
||||
$table->addColumn('role_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR, 'null' => false, 'default' => 0, 'comment' => '角色id'])
|
||||
->addColumn('node_id', 'string', ['limit' => 255, 'null' => false, 'default' => '0', 'comment' => '节点id'])
|
||||
->addIndex(['role_id', 'node_id'], ['name' => 'idx_role_id_node_id'])
|
||||
->create();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user