modified 完善数据迁移脚本

This commit is contained in:
zhaoxiang 2020-03-18 17:57:48 +08:00
parent 3cb72a2647
commit 40ca0ac3bf
2 changed files with 9 additions and 2 deletions

View File

@ -26,7 +26,7 @@ class AddAdminListField extends Migrator {
* with the Table class.
*/
public function up() {
$this->table('admin_list')->addColumn('hash_type', 'string', [
$this->table('admin_list')->addColumn('hash_type', 'integer', [
'limit' => MysqlAdapter::INT_TINY,
'default' => 2,
'comment' => '是否采用hash映射 1普通模式 2加密模式'

View File

@ -1,6 +1,7 @@
<?php
use think\migration\Migrator;
use Phinx\Db\Adapter\MysqlAdapter;
class ChangeAdminMenuField extends Migrator {
/**
@ -25,7 +26,13 @@ class ChangeAdminMenuField extends Migrator {
* with the Table class.
*/
public function up() {
$this->table('admin_menu')->renameColumn('name', 'title')->update();
$this->table('admin_menu')
->renameColumn('name', 'title')
->changeColumn('level', 'integer', [
'limit' => MysqlAdapter::INT_TINY,
'default' => 0,
'comment' => '菜单层级1-一级菜单2-二级菜单3-按钮'
])->update();
}
public function down() {