Migrate Legacy Charset and Encoding
Added 2026-10
Migrate Legacy Charset and Encoding — Chinese original prompt
需要把 [数据库或系统] 从旧字符集迁到 UTF-8。请先摸清影响面:哪些表字段的长度约束会因字节数变化而超限、哪些索引会超出长度限制、哪些下游按字节截断、以及连接与导出链路的编码设置。输出:影响清单、迁移步骤与验证查询、回退方案、上线后如何抽查生僻字与表情符号。
Site original
Chinese original
Example
Sample input
要把老库从旧字符集迁到 UTF-8,先摸清字段长度、索引和下游截断的影响面。
The output should include
- 列出字段长度与索引的影响项
- 每步迁移都要配上验证查询
- 给回退方案与上线后的抽查方法
Replace these placeholders 1
Swap the bracketed parts for your own details before sending.
[数据库或系统]
How to use
索引长度和字段长度都按字节算,迁移前先算最坏情况。
Try tweaking it
- Have it restate requirements and constraints before writing code.
- Ask for the smallest change plus a rollback path, not a full-file rewrite.
What you should get
- A minimal, runnable change with copy-ready code
- Impact list: which files and call sites must follow
Common mistakes
- Asking it to touch ten files at once, then losing track of what broke what.
- Pasting only the error, with no code or version, and getting an unfixable answer.
How to check the output
- The change runs, can be rolled back, and touches nothing unrelated.
- Edge cases (empty, oversized, concurrent) are covered or explained.
Where it works
- Good for: having it restate requirements and constraints, then propose the smallest runnable change.
- Watch out: include versions and a minimal reproduction with the error, or the fix may look plausible but not fit.