sql version control
开发人员工作流程
# 第一步
CREATE TABLE `tm_procedure_info_luoj_20211121_1` ( `id` int(11) NOT NULL, `task` varchar(80) DEFAULT NULL, `proc_name` varchar(50) DEFAULT NULL, `memo` varchar(100) DEFAULT NULL, `status` int(1) DEFAULT NULL, `params` varchar(1000) DEFAULT NULL, `sql_params_service` varchar(80) DEFAULT NULL, `orderno` int(3) DEFAULT NULL, `runsql` text, `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
# 第二步
INSERT INTO tm_procedure_info_luoj_20211121_1 ( `id`, `task`, `proc_name`, `memo`, `status`, `params` , `sql_params_service`, `orderno`, `runsql` , `create_time` ) SELECT `id`, `task`, `proc_name`, `memo`, `status`, `params` , `sql_params_service`, `orderno`, `runsql` , current_timestamp() FROM swr_procedure_info;
# 第三步
# 根据需求修改 sql
select * from tm_procedure_info_luoj_20211121_1
# 第四步
本地 navicat 测试验证
# 第五步
邮件或微信群里提交 存过名称 给 Tony or Jack,由他们将更新合并到 swr_procedure_info master 库,
然后测试验证后,发布 uat & dr & prod
# 第六步 (Tony & Jack)
发布历史备份(1)备份表不用上 uat 等环境
CREATE TABLE `history_procedure_info_tony_20211121_1` ( `id` int(11) NOT NULL, `task` varchar(80) DEFAULT NULL, `proc_name` varchar(50) DEFAULT NULL, `memo` varchar(100) DEFAULT NULL, `status` int(1) DEFAULT NULL, `params` varchar(1000) DEFAULT NULL, `sql_params_service` varchar(80) DEFAULT NULL, `orderno` int(3) DEFAULT NULL, `runsql` text, `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
发布历史备份(2)
INSERT INTO history_procedure_info_tony_20211121_1 ( `id`, `task`, `proc_name`, `memo`, `status`, `params` , `sql_params_service`, `orderno`, `runsql` , `create_time` ) SELECT `id`, `task`, `proc_name`, `memo`, `status`, `params` , `sql_params_service`, `orderno`, `runsql` , current_timestamp() FROM swr_procedure_info; select * from history_procedure_info_tony_20211121_1
# 第七步:merge
比如说:罗建修改了 tm_procedure_info_luoj_20211121_2 表中proc_name为 PROC_SHIA_EDR_POLICY_INFO, PROC_SHIA_UDR_POLICY_INFO, PROC_SHIA_PLY_POLICY_INFO update swr_procedure_info t set create_time=CURRENT_TIMESTAMP(), t.runsql = ( SELECT s.runsql FROM tm_procedure_info_luoj_20211121_2 s WHERE s.id = t.id ) where t.id in ( SELECT s.id FROM tm_procedure_info_luoj_20211121_2 s WHERE s.`proc_name` = 'PROC_SHIA_PLY_POLICY_INFO' ) select * from swr_procedure_info t where t.id in ( SELECT s.id FROM tm_procedure_info_luoj_20211121_2 s WHERE s.`proc_name` = 'PROC_SHIA_PLY_POLICY_INFO' )