-- ---------------------------- -- 发票表结构更新脚本 -- 说明:此脚本用于为发票表添加发票号码、结算关联和税率字段 -- 请根据实际情况谨慎执行,建议先备份数据 -- ---------------------------- -- ---------------------------- -- 第一步:备份原有数据(可选,建议执行) -- ---------------------------- -- 创建备份表 -- create table biz_invoice_backup as select * from biz_invoice; -- ---------------------------- -- 第二步:添加发票号码字段 -- ---------------------------- alter table biz_invoice add column invoice_no varchar(100) default null comment '发票号码' after invoice_title_b; -- ---------------------------- -- 第三步:添加开票日期字段 -- ---------------------------- alter table biz_invoice add column if not exists invoice_date datetime default null comment '开票日期' after invoice_no; -- ---------------------------- -- 第四步:添加结算关联和税率字段 -- ---------------------------- alter table biz_invoice add column if not exists settlement_id bigint(20) default null comment '结算ID' after invoice_amount; alter table biz_invoice add column if not exists tax_rate varchar(10) default null comment '税率(1:6%+2% 2:10%+2% 3:13%+2%)' after payment_remark;