fix: currency/exchange_rate DDL 加 utf8mb4_unicode_ci 防止 collation mismatch

This commit is contained in:
yumoqing 2026-07-10 11:40:03 +08:00
parent 8f09fc43df
commit f9cb644e07

View File

@ -11,7 +11,7 @@ CREATE TABLE IF NOT EXISTS accounting.currency (
decimal_places SMALLINT DEFAULT 2,
is_base VARCHAR(1) DEFAULT '0',
status VARCHAR(16) DEFAULT 'active'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT IGNORE INTO accounting.currency (id, name, symbol, decimal_places, is_base, status) VALUES
('CNY', '人民币', '¥', 2, '1', 'active'),
@ -29,7 +29,7 @@ CREATE TABLE IF NOT EXISTS accounting.exchange_rate (
effective_date DATE NOT NULL,
updated_at DATETIME DEFAULT NULL,
UNIQUE KEY idx_pair_date (from_currency, to_currency, effective_date)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT IGNORE INTO accounting.exchange_rate (id, from_currency, to_currency, buy_rate, sell_rate, mid_rate, effective_date) VALUES
('er_usd_cny', 'USD', 'CNY', 7.150000, 7.250000, 7.200000, '2025-01-01'),