Files
BMS/bms-back/sql/customer+supplier/rename_module_tables_20260924.sql
T
2026-09-24 09:25:47 +08:00

34 lines
1.6 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- =============================================================
-- 表名按模块缩写重命名
-- 供应商模块:bms_supplier* -> sup_supplier*
-- 客户模块: bms_customer* -> ctr_customer*
-- customer_* -> ctr_customer_*
-- 2026-09-24
-- 说明:
-- 1. 14 张表均无外键约束(子表通过 customer_id/supplier_id 逻辑关联),可直接 RENAME;
-- 2. RENAME TABLE 为单条 DDL,MySQL 原子执行;
-- 3. 同步更新代码生成器元数据 gen_table.table_name;
-- 4. 注意:bms_customer_attachment.biz_type 中的枚举值 'customer_receipt' 是业务类型,
-- 不是表名,保持不变。
-- =============================================================
SET NAMES utf8mb4;
RENAME TABLE
bms_supplier TO sup_supplier,
bms_supplier_attachment TO sup_supplier_attachment,
bms_supplier_company TO sup_supplier_company,
bms_supplier_contact TO sup_supplier_contact,
bms_customer TO ctr_customer,
bms_customer_attachment TO ctr_customer_attachment,
bms_customer_company TO ctr_customer_company,
bms_customer_contact TO ctr_customer_contact,
customer_account TO ctr_customer_account,
customer_balance_flow TO ctr_customer_balance_flow,
customer_credit_apply TO ctr_customer_credit_apply,
customer_credit_flow TO ctr_customer_credit_flow,
customer_credit_grant TO ctr_customer_credit_grant,
customer_receipt TO ctr_customer_receipt;
-- 代码生成器元数据(类名 BmsCustomer 不变,仅表名同步)
UPDATE gen_table SET table_name = 'ctr_customer' WHERE table_name = 'bms_customer';