-- 客商档案：联系人地址与客商材料字段补丁

ALTER TABLE `blade_customer_contact`
  ADD COLUMN `region_name` varchar(100) DEFAULT NULL COMMENT '行政区划' AFTER `email`,
  ADD COLUMN `detail_address` varchar(255) DEFAULT NULL COMMENT '详细地址' AFTER `region_name`,
  ADD COLUMN `contact_address` varchar(400) DEFAULT NULL COMMENT '联系地址' AFTER `detail_address`,
  ADD COLUMN `branch_name` varchar(100) DEFAULT NULL COMMENT '所属分公司/事业部' AFTER `contact_address`;

ALTER TABLE `blade_customer_archive`
  ADD COLUMN `registered_region_name` varchar(100) DEFAULT NULL COMMENT '注册地址行政区划' AFTER `registered_address`,
  ADD COLUMN `registered_detail_address` varchar(255) DEFAULT NULL COMMENT '注册地址详细地址' AFTER `registered_region_name`,
  ADD COLUMN `dept_ids` varchar(500) DEFAULT NULL COMMENT '所属组织ID集合' AFTER `dept_id`,
  MODIFY COLUMN `registered_address` varchar(400) DEFAULT NULL COMMENT '注册/实际经营地址',
  MODIFY COLUMN `qualification_attachments` text COMMENT '客商材料JSON';

ALTER TABLE `blade_customer_receipt_account`
  ADD COLUMN `account_holder_name` varchar(50) DEFAULT NULL COMMENT '开户人姓名' AFTER `account_name`,
  ADD COLUMN `remark` varchar(200) DEFAULT NULL COMMENT '备注' AFTER `is_default`;

ALTER TABLE `blade_customer_invoice_info`
  ADD COLUMN `registered_region_name` varchar(100) DEFAULT NULL COMMENT '注册地址行政区划' AFTER `registered_address`,
  ADD COLUMN `registered_detail_address` varchar(255) DEFAULT NULL COMMENT '注册地址详细地址' AFTER `registered_region_name`,
  ADD COLUMN `receiver_region_name` varchar(100) DEFAULT NULL COMMENT '收件人地址行政区划' AFTER `receiver_address`,
  ADD COLUMN `receiver_detail_address` varchar(255) DEFAULT NULL COMMENT '收件人详细地址' AFTER `receiver_region_name`,
  MODIFY COLUMN `registered_address` varchar(400) DEFAULT NULL COMMENT '注册地址',
  MODIFY COLUMN `receiver_address` varchar(400) DEFAULT NULL COMMENT '收件人地址';
