完成大部分标的数据库迁移的安装工具;

This commit is contained in:
2022-04-19 12:02:55 +08:00
parent 82e30f819e
commit f7633cbfc4
7 changed files with 311 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
class SystemNode extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('system_node')
->setComment('系统节点表')
->addColumn(Column::char('node', 100)->setDefault('')->setComment('节点代码'))
->addColumn(Column::char('title')->setDefault('')->setComment('节点标题'))
->addColumn(Column::tinyInteger('type')->setUnsigned()->setLimit(1)->setComment('节点类型1控制器2节点'))
->addColumn(Column::tinyInteger('is_auth')->setUnsigned()->setLimit(1)->setDefault(1)->setComment('是否启动RBAC权限控制'))
->addColumn(Column::integer('create_time')->setLimit(11)->setDefault(0))
->addColumn(Column::integer('update_time')->setLimit(11)->setDefault(0))
->addIndex('node')
->create();
}
}