初始化
This commit is contained in:
36
db/migrations/20231019090238_create_admin_roles.php
Normal file
36
db/migrations/20231019090238_create_admin_roles.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Db\Adapter\MysqlAdapter;
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class CreateAdminRoles 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_roles');
|
||||
if (!$exists) {
|
||||
$table = $this->table('admin_roles', ['comment' => '系统角色表']);
|
||||
$table->addColumn('name', 'string', ['limit' => 20, 'null' => false, 'default' => '', 'comment' => '权限角色名称'])
|
||||
->addColumn('desc', 'string', ['limit' => 255, 'null' => false, 'default' => '', 'comment' => '备注说明'])
|
||||
->addColumn('sort', 'integer', ['limit' => MysqlAdapter::INT_REGULAR, 'null' => false, 'default' => 0, 'comment' => '排序'])
|
||||
->addColumn('created_at', 'datetime', ['comment' => '创建时间'])
|
||||
->addColumn('updated_at', 'datetime', ['comment' => '更新时间'])
|
||||
->addColumn('check_strictly', 'integer', ['limit' => MysqlAdapter::INT_TINY, 'null' => false, 'default' => 0, 'comment' => '数据权限类型:0=全部数据权限,1=自定义数据权限,2=本部门及以下数据权限,3=本部门数据权限,4=本人数据权限'])
|
||||
->addColumn('type', 'integer', ['limit' => MysqlAdapter::INT_TINY, 'null' => false, 'default' => 1, 'comment' => '1 总后台 2渠道后台'])
|
||||
->create();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user