修改数据库

This commit is contained in:
邹景立 2022-11-04 14:50:30 +08:00
parent 2cd8bd973a
commit 2efa2ebb33
6 changed files with 1201 additions and 454 deletions

View File

@ -49,6 +49,9 @@ class InstallAdmin extends Migrator
->addIndex('status', ['name' => 'idx_system_auth_status'])
->addIndex('title', ['name' => 'idx_system_auth_title'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -75,6 +78,9 @@ class InstallAdmin extends Migrator
->addIndex('auth', ['name' => 'idx_system_auth_node_auth'])
->addIndex('node', ['name' => 'idx_system_auth_node_node'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -110,6 +116,9 @@ class InstallAdmin extends Migrator
->addIndex('code', ['name' => 'idx_system_base_code'])
->addIndex('name', ['name' => 'idx_system_base_name'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -137,6 +146,9 @@ class InstallAdmin extends Migrator
->addIndex('type', ['name' => 'idx_system_config_type'])
->addIndex('name', ['name' => 'idx_system_config_name'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -162,6 +174,9 @@ class InstallAdmin extends Migrator
->addColumn('value', 'text', ['default' => null, 'comment' => '配置值'])
->addIndex('name', ['name' => 'idx_system_data_name'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -205,6 +220,9 @@ class InstallAdmin extends Migrator
->addIndex('issafe', ['name' => 'idx_system_file_issafe'])
->addIndex('isfast', ['name' => 'idx_system_file_isfast'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -238,6 +256,9 @@ class InstallAdmin extends Migrator
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->addIndex('status', ['name' => 'idx_system_menu_status'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -266,6 +287,9 @@ class InstallAdmin extends Migrator
->addColumn('username', 'string', ['limit' => 50, 'default' => '', 'comment' => '操作人用户名'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -308,6 +332,9 @@ class InstallAdmin extends Migrator
->addIndex('create_at', ['name' => 'idx_system_queue_create_at'])
->addIndex('exec_time', ['name' => 'idx_system_queue_exec_time'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -350,5 +377,8 @@ class InstallAdmin extends Migrator
->addIndex('username', ['name' => 'idx_system_user_username'])
->addIndex('is_deleted', ['name' => 'idx_system_user_is_deleted'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
}

View File

@ -72,6 +72,9 @@ class InstallUser extends Migrator
->addIndex('status', ['name' => 'idx_base_postage_company_status'])
->addIndex('deleted', ['name' => 'idx_base_postage_company_deleted'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -106,6 +109,9 @@ class InstallUser extends Migrator
->addIndex('pid', ['name' => 'idx_base_postage_region_pid'])
->addIndex('name', ['name' => 'idx_base_postage_region_name'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -139,6 +145,9 @@ class InstallUser extends Migrator
->addIndex('status', ['name' => 'idx_base_postage_template_status'])
->addIndex('deleted', ['name' => 'idx_base_postage_template_deleted'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -170,6 +179,9 @@ class InstallUser extends Migrator
->addIndex('status', ['name' => 'idx_base_user_discount_status'])
->addIndex('deleted', ['name' => 'idx_base_user_discount_deleted'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -203,6 +215,9 @@ class InstallUser extends Migrator
->addIndex('status', ['name' => 'idx_base_user_message_status'])
->addIndex('deleted', ['name' => 'idx_base_user_message_deleted'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -239,6 +254,9 @@ class InstallUser extends Migrator
->addIndex('status', ['name' => 'idx_base_user_payment_status'])
->addIndex('deleted', ['name' => 'idx_base_user_payment_deleted'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -281,6 +299,9 @@ class InstallUser extends Migrator
->addIndex('status', ['name' => 'idx_base_user_upgrade_status'])
->addIndex('number', ['name' => 'idx_base_user_upgrade_number'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -320,6 +341,9 @@ class InstallUser extends Migrator
->addIndex('status', ['name' => 'idx_data_news_item_status'])
->addIndex('deleted', ['name' => 'idx_data_news_item_deleted'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -350,6 +374,9 @@ class InstallUser extends Migrator
->addIndex('status', ['name' => 'idx_data_news_mark_status'])
->addIndex('deleted', ['name' => 'idx_data_news_mark_deleted'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -382,6 +409,9 @@ class InstallUser extends Migrator
->addIndex('status', ['name' => 'idx_data_news_x_collect_status'])
->addIndex('uuid', ['name' => 'idx_data_news_x_collect_uuid'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -457,6 +487,9 @@ class InstallUser extends Migrator
->addIndex('pid0', ['name' => 'idx_data_user_pid0'])
->addIndex('pids', ['name' => 'idx_data_user_pids'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -497,6 +530,9 @@ class InstallUser extends Migrator
->addIndex('deleted', ['name' => 'idx_data_user_address_deleted'])
->addIndex('uuid', ['name' => 'idx_data_user_address_uuid'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -531,6 +567,9 @@ class InstallUser extends Migrator
->addIndex('deleted', ['name' => 'idx_data_user_balance_deleted'])
->addIndex('uuid', ['name' => 'idx_data_user_balance_uuid'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -561,6 +600,9 @@ class InstallUser extends Migrator
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '注册时间'])
->addIndex('uuid', ['name' => 'idx_data_user_logger_uuid'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -595,6 +637,9 @@ class InstallUser extends Migrator
->addIndex('phone', ['name' => 'idx_data_user_message_phone'])
->addIndex('msgid', ['name' => 'idx_data_user_message_msgid'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -632,6 +677,9 @@ class InstallUser extends Migrator
->addIndex('payment_trade', ['name' => 'idx_data_user_payment_payment_trade'])
->addIndex('payment_status', ['name' => 'idx_data_user_payment_payment_status'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -672,6 +720,9 @@ class InstallUser extends Migrator
->addIndex('status', ['name' => 'idx_data_user_rebate_status'])
->addIndex('uuid', ['name' => 'idx_data_user_rebate_uuid'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -704,6 +755,9 @@ class InstallUser extends Migrator
->addIndex('time', ['name' => 'idx_data_user_token_time'])
->addIndex('token', ['name' => 'idx_data_user_token_token'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -761,6 +815,9 @@ class InstallUser extends Migrator
->addIndex('openid', ['name' => 'idx_data_user_transfer_openid'])
->addIndex('uuid', ['name' => 'idx_data_user_transfer_uuid'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -817,6 +874,9 @@ class InstallUser extends Migrator
->addIndex('status', ['name' => 'idx_shop_goods_status'])
->addIndex('deleted', ['name' => 'idx_shop_goods_deleted'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -850,6 +910,9 @@ class InstallUser extends Migrator
->addIndex('status', ['name' => 'idx_shop_goods_cate_status'])
->addIndex('deleted', ['name' => 'idx_shop_goods_cate_deleted'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -888,6 +951,9 @@ class InstallUser extends Migrator
->addIndex('goods_spec', ['name' => 'idx_shop_goods_item_goods_spec'])
->addIndex('status', ['name' => 'idx_shop_goods_item_status'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -917,6 +983,9 @@ class InstallUser extends Migrator
->addIndex('sort', ['name' => 'idx_shop_goods_mark_sort'])
->addIndex('status', ['name' => 'idx_shop_goods_mark_status'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -948,6 +1017,9 @@ class InstallUser extends Migrator
->addIndex('status', ['name' => 'idx_shop_goods_stock_status'])
->addIndex('deleted', ['name' => 'idx_shop_goods_stock_deleted'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -1011,6 +1083,9 @@ class InstallUser extends Migrator
->addIndex('deleted_status', ['name' => 'idx_shop_order_deleted_status'])
->addIndex('uuid', ['name' => 'idx_shop_order_uuid'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -1070,6 +1145,9 @@ class InstallUser extends Migrator
->addIndex('goods_spec', ['name' => 'idx_shop_order_item_goods_spec'])
->addIndex('rebate_type', ['name' => 'idx_shop_order_item_rebate_type'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -1121,5 +1199,8 @@ class InstallUser extends Migrator
->addIndex('deleted', ['name' => 'idx_shop_order_send_deleted'])
->addIndex('order_no', ['name' => 'idx_shop_order_send_order_no'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
}

View File

@ -18,7 +18,6 @@ class InstallWechat extends Migrator
$this->_create_wechat_news_article();
}
/**
* 创建数据对象
* @class WechatAuto
@ -61,6 +60,9 @@ class InstallWechat extends Migrator
->addIndex('code', ['name' => 'idx_wechat_auto_code'])
->addIndex('appid', ['name' => 'idx_wechat_auto_appid'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -107,6 +109,9 @@ class InstallWechat extends Migrator
->addIndex('is_black', ['name' => 'idx_wechat_fans_is_black'])
->addIndex('subscribe', ['name' => 'idx_wechat_fans_subscribe'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -135,6 +140,9 @@ class InstallWechat extends Migrator
->addIndex('id', ['name' => 'idx_wechat_fans_tags_id'])
->addIndex('appid', ['name' => 'idx_wechat_fans_tags_appid'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -178,6 +186,9 @@ class InstallWechat extends Migrator
->addIndex('type', ['name' => 'idx_wechat_keys_type'])
->addIndex('keys', ['name' => 'idx_wechat_keys_keys'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -211,6 +222,9 @@ class InstallWechat extends Migrator
->addIndex('type', ['name' => 'idx_wechat_media_type'])
->addIndex('media_id', ['name' => 'idx_wechat_media_media_id'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -241,6 +255,9 @@ class InstallWechat extends Migrator
->addIndex('article_id', ['name' => 'idx_wechat_news_article_id'])
->addIndex('media_id', ['name' => 'idx_wechat_news_media_id'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
@ -272,5 +289,8 @@ class InstallWechat extends Migrator
->addColumn('read_num', 'biginteger', ['limit' => 20, 'default' => 0, 'comment' => '阅读数量'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
}

View File

@ -9,69 +9,128 @@ class InstallAdmin extends Migrator
{
public function change()
{
$this->_auth();
$this->_base();
$this->_conf();
$this->_data();
$this->_file();
$this->_menu();
$this->_node();
$this->_oplog();
$this->_queue();
$this->_user();
$this->_create_system_auth();
$this->_create_system_auth_node();
$this->_create_system_base();
$this->_create_system_config();
$this->_create_system_data();
$this->_create_system_file();
$this->_create_system_menu();
$this->_create_system_oplog();
$this->_create_system_queue();
$this->_create_system_user();
}
private function _auth()
/**
* 创建数据对象
* @class SystemAuth
* @table system_auth
* @return void
*/
private function _create_system_auth()
{
// 当前操作
// 当前数据表
$table = 'system_auth';
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
// 存在则跳过
if ($this->hasTable($table)) return;
// 创建数据表
$this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-权限',
])
->addColumn('title', 'string', ['limit' => 80, 'default' => '', 'comment' => '权限名称'])
->addColumn('title', 'string', ['limit' => 100, 'default' => '', 'comment' => '权限名称'])
->addColumn('utype', 'string', ['limit' => 50, 'default' => '', 'comment' => '身份权限'])
->addColumn('desc', 'string', ['limit' => 500, 'default' => '', 'comment' => '备注说明'])
->addColumn('sort', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '排序权重'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '状态(0禁用,1启用)'])
->addColumn('sort', 'biginteger', ['limit' => 20, 'default' => 0, 'comment' => '排序权重'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '权限状态(1使用,0禁用)'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->addIndex('sort', ['name' => 'idx_system_auth_sort'])
->addIndex('title', ['name' => 'idx_system_auth_title'])
->addIndex('status', ['name' => 'idx_system_auth_status'])
->addIndex('title', ['name' => 'idx_system_auth_title'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
private function _base()
/**
* 创建数据对象
* @class SystemAuthNode
* @table system_auth_node
* @return void
*/
private function _create_system_auth_node()
{
// 当前操作
// 当前数据表
$table = 'system_auth_node';
// 存在则跳过
if ($this->hasTable($table)) return;
// 创建数据表
$this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-授权',
])
->addColumn('auth', 'biginteger', ['limit' => 20, 'default' => 0, 'comment' => '角色'])
->addColumn('node', 'string', ['limit' => 200, 'default' => '', 'comment' => '节点'])
->addIndex('auth', ['name' => 'idx_system_auth_node_auth'])
->addIndex('node', ['name' => 'idx_system_auth_node_node'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
* 创建数据对象
* @class SystemBase
* @table system_base
* @return void
*/
private function _create_system_base()
{
// 当前数据表
$table = 'system_base';
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
// 存在则跳过
if ($this->hasTable($table)) return;
// 创建数据表
$this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-字典',
])
->addColumn('type', 'string', ['limit' => 20, 'default' => '', 'comment' => '数据类型'])
->addColumn('code', 'string', ['limit' => 100, 'default' => '', 'comment' => '数据代码'])
->addColumn('name', 'string', ['limit' => 500, 'default' => '', 'comment' => '数据名称'])
->addColumn('content', 'text', ['default' => '', 'comment' => '数据内容'])
->addColumn('sort', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '排序权重'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '状态(0禁用,1启用)'])
->addColumn('deleted', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '删除(0正常,1已删)'])
->addColumn('content', 'text', ['default' => null, 'comment' => '数据内容'])
->addColumn('sort', 'biginteger', ['limit' => 20, 'default' => 0, 'comment' => '排序权重'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '数据状态(0禁用,1启动)'])
->addColumn('deleted', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '删除状态(0正常,1已删)'])
->addColumn('deleted_at', 'string', ['limit' => 20, 'default' => '', 'comment' => '删除时间'])
->addColumn('deleted_by', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '删除用户'])
->addColumn('deleted_by', 'biginteger', ['limit' => 20, 'default' => 0, 'comment' => '删除用户'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->addIndex('type', ['name' => 'idx_system_base_type'])
->addIndex('code', ['name' => 'idx_system_base_code'])
->addIndex('name', ['name' => 'idx_system_base_name'])
->addIndex('sort', ['name' => 'idx_system_base_sort'])
->addIndex('status', ['name' => 'idx_system_base_status'])
->addIndex('deleted', ['name' => 'idx_system_base_deleted'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
private function _conf()
/**
* 创建数据对象
* @class SystemConfig
* @table system_config
* @return void
*/
private function _create_system_config()
{
// 当前操作
// 当前数据表
$table = 'system_config';
// 存在则跳过
@ -87,10 +146,20 @@ class InstallAdmin extends Migrator
->addIndex('type', ['name' => 'idx_system_config_type'])
->addIndex('name', ['name' => 'idx_system_config_name'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
private function _data()
/**
* 创建数据对象
* @class SystemData
* @table system_data
* @return void
*/
private function _create_system_data()
{
// 当前数据表
$table = 'system_data';
@ -105,10 +174,20 @@ class InstallAdmin extends Migrator
->addColumn('value', 'text', ['default' => null, 'comment' => '配置值'])
->addIndex('name', ['name' => 'idx_system_data_name'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
private function _file()
/**
* 创建数据对象
* @class SystemFile
* @table system_file
* @return void
*/
private function _create_system_file()
{
// 当前数据表
$table = 'system_file';
@ -126,8 +205,8 @@ class InstallAdmin extends Migrator
->addColumn('xurl', 'string', ['limit' => 500, 'default' => '', 'comment' => '访问链接'])
->addColumn('xkey', 'string', ['limit' => 500, 'default' => '', 'comment' => '文件路径'])
->addColumn('mime', 'string', ['limit' => 100, 'default' => '', 'comment' => '文件类型'])
->addColumn('size', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '文件大小'])
->addColumn('uuid', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '用户编号'])
->addColumn('size', 'biginteger', ['limit' => 20, 'default' => 0, 'comment' => '文件大小'])
->addColumn('uuid', 'biginteger', ['limit' => 20, 'default' => 0, 'comment' => '用户编号'])
->addColumn('isfast', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '是否秒传'])
->addColumn('issafe', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '安全模式'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '上传状态(1悬空,2落地)'])
@ -141,10 +220,20 @@ class InstallAdmin extends Migrator
->addIndex('issafe', ['name' => 'idx_system_file_issafe'])
->addIndex('isfast', ['name' => 'idx_system_file_isfast'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
private function _menu()
/**
* 创建数据对象
* @class SystemMenu
* @table system_menu
* @return void
*/
private function _create_system_menu()
{
// 当前数据表
$table = 'system_menu';
@ -155,7 +244,7 @@ class InstallAdmin extends Migrator
$this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-菜单',
])
->addColumn('pid', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '上级ID'])
->addColumn('pid', 'biginteger', ['limit' => 20, 'default' => 0, 'comment' => '上级ID'])
->addColumn('title', 'string', ['limit' => 100, 'default' => '', 'comment' => '菜单名称'])
->addColumn('icon', 'string', ['limit' => 100, 'default' => '', 'comment' => '菜单图标'])
->addColumn('node', 'string', ['limit' => 100, 'default' => '', 'comment' => '节点代码'])
@ -163,32 +252,24 @@ class InstallAdmin extends Migrator
->addColumn('params', 'string', ['limit' => 500, 'default' => '', 'comment' => '链接参数'])
->addColumn('target', 'string', ['limit' => 20, 'default' => '_self', 'comment' => '打开方式'])
->addColumn('sort', 'integer', ['limit' => 11, 'default' => 0, 'comment' => '排序权重'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '状态(0禁用,1启用)'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '状态(0:禁用,1:启用)'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->addIndex('pid', ['name' => 'idx_system_menu_pid'])
->addIndex('sort', ['name' => 'idx_system_menu_sort'])
->addIndex('status', ['name' => 'idx_system_menu_status'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
private function _node()
/**
* 创建数据对象
* @class SystemOplog
* @table system_oplog
* @return void
*/
private function _create_system_oplog()
{
// 当前操作
$table = 'system_auth_node';
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-授权',
])
->addColumn('auth', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '角色编号'])
->addColumn('node', 'string', ['limit' => 200, 'default' => '', 'comment' => '节点路径'])
->addIndex('auth', ['name' => 'idx_system_auth_node_auth'])
->addIndex('node', ['name' => 'idx_system_auth_node_node'])
->save();
}
private function _oplog()
{
// 当前数据表
$table = 'system_oplog';
@ -206,10 +287,20 @@ class InstallAdmin extends Migrator
->addColumn('username', 'string', ['limit' => 50, 'default' => '', 'comment' => '操作人用户名'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
private function _queue()
/**
* 创建数据对象
* @class SystemQueue
* @table system_queue
* @return void
*/
private function _create_system_queue()
{
// 当前数据表
$table = 'system_queue';
@ -223,14 +314,14 @@ class InstallAdmin extends Migrator
->addColumn('code', 'string', ['limit' => 20, 'default' => '', 'comment' => '任务编号'])
->addColumn('title', 'string', ['limit' => 100, 'default' => '', 'comment' => '任务名称'])
->addColumn('command', 'string', ['limit' => 500, 'default' => '', 'comment' => '执行指令'])
->addColumn('exec_pid', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '执行进程'])
->addColumn('exec_pid', 'biginteger', ['limit' => 20, 'default' => 0, 'comment' => '执行进程'])
->addColumn('exec_data', 'text', ['default' => null, 'comment' => '执行参数'])
->addColumn('exec_time', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '执行时间'])
->addColumn('exec_time', 'biginteger', ['limit' => 20, 'default' => 0, 'comment' => '执行时间'])
->addColumn('exec_desc', 'string', ['limit' => 500, 'default' => '', 'comment' => '执行描述'])
->addColumn('enter_time', 'decimal', ['precision' => 20, 'scale' => 4, 'default' => '0.0000', 'comment' => '开始时间'])
->addColumn('outer_time', 'decimal', ['precision' => 20, 'scale' => 4, 'default' => '0.0000', 'comment' => '结束时间'])
->addColumn('loops_time', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '循环时间'])
->addColumn('attempts', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '执行次数'])
->addColumn('loops_time', 'biginteger', ['limit' => 20, 'default' => 0, 'comment' => '循环时间'])
->addColumn('attempts', 'biginteger', ['limit' => 20, 'default' => 0, 'comment' => '执行次数'])
->addColumn('rscript', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '任务类型(0单例,1多例)'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '任务状态(1新任务,2处理中,3成功,4失败)'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
@ -238,13 +329,23 @@ class InstallAdmin extends Migrator
->addIndex('title', ['name' => 'idx_system_queue_title'])
->addIndex('status', ['name' => 'idx_system_queue_status'])
->addIndex('rscript', ['name' => 'idx_system_queue_rscript'])
->addIndex('exec_time', ['name' => 'idx_system_queue_exec_time'])
->addIndex('create_at', ['name' => 'idx_system_queue_create_at'])
->addIndex('exec_time', ['name' => 'idx_system_queue_exec_time'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
private function _user()
/**
* 创建数据对象
* @class SystemUser
* @table system_user
* @return void
*/
private function _create_system_user()
{
// 当前数据表
$table = 'system_user';
@ -262,19 +363,22 @@ class InstallAdmin extends Migrator
->addColumn('headimg', 'string', ['limit' => 255, 'default' => '', 'comment' => '头像地址'])
->addColumn('authorize', 'string', ['limit' => 255, 'default' => '', 'comment' => '权限授权'])
->addColumn('contact_qq', 'string', ['limit' => 20, 'default' => '', 'comment' => '联系QQ'])
->addColumn('contact_mail', 'string', ['limit' => 50, 'default' => '', 'comment' => '联系邮箱'])
->addColumn('contact_phone', 'string', ['limit' => 50, 'default' => '', 'comment' => '联系手机'])
->addColumn('contact_mail', 'string', ['limit' => 20, 'default' => '', 'comment' => '联系邮箱'])
->addColumn('contact_phone', 'string', ['limit' => 20, 'default' => '', 'comment' => '联系手机'])
->addColumn('login_ip', 'string', ['limit' => 255, 'default' => '', 'comment' => '登录地址'])
->addColumn('login_at', 'string', ['limit' => 20, 'default' => '', 'comment' => '登录时间'])
->addColumn('login_num', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '登录次数'])
->addColumn('login_num', 'biginteger', ['limit' => 20, 'default' => 0, 'comment' => '登录次数'])
->addColumn('describe', 'string', ['limit' => 255, 'default' => '', 'comment' => '备注说明'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '状态(0禁用,1启用)'])
->addColumn('sort', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '排序权重'])
->addColumn('sort', 'biginteger', ['limit' => 20, 'default' => 0, 'comment' => '排序权重'])
->addColumn('is_deleted', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '删除(1删除,0未删)'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->addIndex('status', ['name' => 'idx_system_user_status'])
->addIndex('username', ['name' => 'idx_system_user_username'])
->addIndex('is_deleted', ['name' => 'idx_system_user_is_deleted'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
}

View File

@ -9,17 +9,24 @@ class InstallWechat extends Migrator
{
public function change()
{
$this->_auto();
$this->_fans();
$this->_tags();
$this->_keys();
$this->_news();
$this->_media();
$this->_article();
$this->_create_wechat_auto();
$this->_create_wechat_fans();
$this->_create_wechat_fans_tags();
$this->_create_wechat_keys();
$this->_create_wechat_media();
$this->_create_wechat_news();
$this->_create_wechat_news_article();
}
private function _auto()
/**
* 创建数据对象
* @class WechatAuto
* @table wechat_auto
* @return void
*/
private function _create_wechat_auto()
{
// 当前数据表
$table = 'wechat_auto';
@ -44,19 +51,29 @@ class InstallWechat extends Migrator
->addColumn('video_title', 'string', ['limit' => 100, 'default' => '', 'comment' => '视频标题'])
->addColumn('video_url', 'string', ['limit' => 255, 'default' => '', 'comment' => '视频URL'])
->addColumn('video_desc', 'string', ['limit' => 255, 'default' => '', 'comment' => '视频描述'])
->addColumn('news_id', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '图文ID'])
->addColumn('news_id', 'biginteger', ['limit' => 20, 'default' => 0, 'comment' => '图文ID'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '状态(0禁用,1启用)'])
->addColumn('create_by', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '创建人'])
->addColumn('create_by', 'biginteger', ['limit' => 20, 'default' => 0, 'comment' => '创建人'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->addIndex('type', ['name' => 'idx_wechat_auto_type'])
->addIndex('time', ['name' => 'idx_wechat_auto_time'])
->addIndex('code', ['name' => 'idx_wechat_auto_code'])
->addIndex('appid', ['name' => 'idx_wechat_auto_appid'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
private function _fans()
/**
* 创建数据对象
* @class WechatFans
* @table wechat_fans
* @return void
*/
private function _create_wechat_fans()
{
// 当前数据表
$table = 'wechat_fans';
@ -80,7 +97,7 @@ class InstallWechat extends Migrator
->addColumn('city', 'string', ['limit' => 50, 'default' => '', 'comment' => '用户所在城市'])
->addColumn('language', 'string', ['limit' => 50, 'default' => '', 'comment' => '用户的语言(zh_CN)'])
->addColumn('headimgurl', 'string', ['limit' => 500, 'default' => '', 'comment' => '用户头像'])
->addColumn('subscribe_time', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '关注时间'])
->addColumn('subscribe_time', 'biginteger', ['limit' => 20, 'default' => 0, 'comment' => '关注时间'])
->addColumn('subscribe_at', 'datetime', ['default' => null, 'comment' => '关注时间'])
->addColumn('remark', 'string', ['limit' => 50, 'default' => '', 'comment' => '备注'])
->addColumn('subscribe_scene', 'string', ['limit' => 200, 'default' => '', 'comment' => '扫码关注场景'])
@ -92,10 +109,20 @@ class InstallWechat extends Migrator
->addIndex('is_black', ['name' => 'idx_wechat_fans_is_black'])
->addIndex('subscribe', ['name' => 'idx_wechat_fans_subscribe'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
private function _tags()
/**
* 创建数据对象
* @class WechatFansTags
* @table wechat_fans_tags
* @return void
*/
private function _create_wechat_fans_tags()
{
// 当前数据表
$table = 'wechat_fans_tags';
@ -107,16 +134,26 @@ class InstallWechat extends Migrator
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-标签',
])
->addColumn('appid', 'string', ['limit' => 50, 'default' => '', 'comment' => '公众号APPID'])
->addColumn('name', 'string', ['limit' => 35, 'default' => null, 'comment' => '标签名称'])
->addColumn('count', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '总数'])
->addColumn('name', 'string', ['limit' => 35, 'default' => '', 'comment' => '标签名称'])
->addColumn('count', 'biginteger', ['limit' => 20, 'default' => 0, 'comment' => '总数'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建日期'])
->addIndex('id', ['name' => 'idx_wechat_fans_tags_id'])
->addIndex('appid', ['name' => 'idx_wechat_fans_tags_appid'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
private function _keys()
/**
* 创建数据对象
* @class WechatKeys
* @table wechat_keys
* @return void
*/
private function _create_wechat_keys()
{
// 当前数据表
$table = 'wechat_keys';
@ -129,7 +166,7 @@ class InstallWechat extends Migrator
])
->addColumn('appid', 'string', ['limit' => 100, 'default' => '', 'comment' => '公众号APPID'])
->addColumn('type', 'string', ['limit' => 20, 'default' => '', 'comment' => '类型(text,image,news)'])
->addColumn('keys', 'string', ['limit' => 100, 'default' => null, 'comment' => '关键字'])
->addColumn('keys', 'string', ['limit' => 100, 'default' => '', 'comment' => '关键字'])
->addColumn('content', 'text', ['default' => null, 'comment' => '文本内容'])
->addColumn('image_url', 'string', ['limit' => 255, 'default' => '', 'comment' => '图片链接'])
->addColumn('voice_url', 'string', ['limit' => 255, 'default' => '', 'comment' => '语音链接'])
@ -140,42 +177,29 @@ class InstallWechat extends Migrator
->addColumn('video_title', 'string', ['limit' => 100, 'default' => '', 'comment' => '视频标题'])
->addColumn('video_url', 'string', ['limit' => 255, 'default' => '', 'comment' => '视频URL'])
->addColumn('video_desc', 'string', ['limit' => 255, 'default' => '', 'comment' => '视频描述'])
->addColumn('news_id', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '图文ID'])
->addColumn('sort', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '排序字段'])
->addColumn('news_id', 'biginteger', ['limit' => 20, 'default' => 0, 'comment' => '图文ID'])
->addColumn('sort', 'biginteger', ['limit' => 20, 'default' => 0, 'comment' => '排序字段'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '状态(0禁用,1启用)'])
->addColumn('create_by', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '创建人'])
->addColumn('create_by', 'biginteger', ['limit' => 20, 'default' => 0, 'comment' => '创建人'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->addIndex('keys', ['name' => 'idx_wechat_keys_keys'])
->addIndex('type', ['name' => 'idx_wechat_keys_type'])
->addIndex('appid', ['name' => 'idx_wechat_keys_appid'])
->addIndex('type', ['name' => 'idx_wechat_keys_type'])
->addIndex('keys', ['name' => 'idx_wechat_keys_keys'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
private function _news()
/**
* 创建数据对象
* @class WechatMedia
* @table wechat_media
* @return void
*/
private function _create_wechat_media()
{
// 当前数据表
$table = 'wechat_news';
// 存在则跳过
if ($this->hasTable($table)) return;
// 创建数据表
$this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-图文',
])
->addColumn('media_id', 'string', ['limit' => 100, 'default' => '', 'comment' => '永久素材MediaID'])
->addColumn('local_url', 'string', ['limit' => 300, 'default' => '', 'comment' => '永久素材外网URL'])
->addColumn('article_id', 'string', ['limit' => 60, 'default' => '', 'comment' => '关联图文ID(用英文逗号做分割)'])
->addColumn('is_deleted', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '删除状态(0未删除,1已删除)'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->addColumn('create_by', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '创建人'])
->addIndex('media_id', ['name' => 'idx_wechat_news_media_id'])
->addIndex('article_id', ['name' => 'idx_wechat_news_article_id'])
->save();
}
private function _media()
{
// 当前数据表
$table = 'wechat_media';
@ -193,15 +217,58 @@ class InstallWechat extends Migrator
->addColumn('local_url', 'string', ['limit' => 300, 'default' => '', 'comment' => '本地文件链接'])
->addColumn('media_url', 'string', ['limit' => 300, 'default' => '', 'comment' => '远程图片链接'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->addIndex('appid', ['name' => 'idx_wechat_media_appid'])
->addIndex('md5', ['name' => 'idx_wechat_media_md5'])
->addIndex('type', ['name' => 'idx_wechat_media_type'])
->addIndex('appid', ['name' => 'idx_wechat_media_appid'])
->addIndex('media_id', ['name' => 'idx_wechat_media_media_id'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
private function _article()
/**
* 创建数据对象
* @class WechatNews
* @table wechat_news
* @return void
*/
private function _create_wechat_news()
{
// 当前数据表
$table = 'wechat_news';
// 存在则跳过
if ($this->hasTable($table)) return;
// 创建数据表
$this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-图文',
])
->addColumn('media_id', 'string', ['limit' => 100, 'default' => '', 'comment' => '永久素材MediaID'])
->addColumn('local_url', 'string', ['limit' => 300, 'default' => '', 'comment' => '永久素材外网URL'])
->addColumn('article_id', 'string', ['limit' => 60, 'default' => '', 'comment' => '关联图文ID(用英文逗号做分割)'])
->addColumn('is_deleted', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '删除状态(0未删除,1已删除)'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->addColumn('create_by', 'biginteger', ['limit' => 20, 'default' => 0, 'comment' => '创建人'])
->addIndex('article_id', ['name' => 'idx_wechat_news_article_id'])
->addIndex('media_id', ['name' => 'idx_wechat_news_media_id'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
/**
* 创建数据对象
* @class WechatNewsArticle
* @table wechat_news_article
* @return void
*/
private function _create_wechat_news_article()
{
// 当前数据表
$table = 'wechat_news_article';
@ -219,8 +286,11 @@ class InstallWechat extends Migrator
->addColumn('digest', 'string', ['limit' => 300, 'default' => '', 'comment' => '摘要内容'])
->addColumn('content', 'text', ['default' => null, 'comment' => '图文内容'])
->addColumn('content_source_url', 'string', ['limit' => 200, 'default' => '', 'comment' => '原文地址'])
->addColumn('read_num', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '阅读数量'])
->addColumn('read_num', 'biginteger', ['limit' => 20, 'default' => 0, 'comment' => '阅读数量'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->save();
// 修改主键长度
$this->table($table)->changeColumn('id', 'biginteger', ['limit' => 20]);
}
}

File diff suppressed because it is too large Load Diff