refactor: 优化数据库迁移文件约束和注释

**迁移文件优化**:
- 001_users.up.sql: 添加完整表和列注释,说明密码哈希算法 (bcrypt) 和 token 哈希算法 (SHA-256)
- 002_messages.up.sql: 收紧 role 字段至 VARCHAR(10),添加 tokens_used 非负约束,补充完整注释
- 003_sessions.up.sql: 收紧 title 字段至 VARCHAR(100) 并添加长度约束 (1-100),详细说明 config JSONB 结构
- 004_user_scenarios.up.sql: 修复 greeting 字段冲突 (VARCHAR(500)),扩大 icon 至 VARCHAR(20) 支持复合 Emoji,prompt 改为 TEXT 无上限,优化约束逻辑

**后端代码修改**:
- auth.go: 移除用户名最小长度限制 (3 字符),仅保留最大长度 64

**前端国际化修改**:
- 更新三种语言的登录/注册表单 placeholder 文本,移除字符长度要求提示
  - zh-CN: "请输入用户名" / "请输入密码"
  - en-US: "Enter username" / "Enter password"
  - ja-JP: "ユーザー名を入力" / "パスワードを入力"

**删除文件**:
- 移除临时修复迁移文件 (005_fix_user_scenarios_description.*)
- 删除临时诊断脚本 (fix_user_scenarios.sql, check_constraints.sql)

所有约束修改都是放宽限制,不影响现有数据。
This commit is contained in:
hhs
2026-06-23 23:41:49 +08:00
parent 4dd4138197
commit 74f1a8eb34
12 changed files with 67 additions and 91 deletions

View File

@@ -155,9 +155,9 @@ export const enUS: TranslationMap = {
"auth.login": "Sign In",
"auth.register": "Sign Up",
"auth.username": "Username",
"auth.username.placeholder": "3-64 characters",
"auth.username.placeholder": "Enter username",
"auth.password": "Password",
"auth.password.placeholder": "8-72 characters",
"auth.password.placeholder": "Enter password",
"auth.submitting": "Please wait...",
"auth.noAccount": "Don't have an account?",
"auth.hasAccount": "Already have an account?",

View File

@@ -155,9 +155,9 @@ export const jaJP: TranslationMap = {
"auth.login": "ログイン",
"auth.register": "新規登録",
"auth.username": "ユーザー名",
"auth.username.placeholder": "3〜64文字",
"auth.username.placeholder": "ユーザー名を入力",
"auth.password": "パスワード",
"auth.password.placeholder": "8〜72文字",
"auth.password.placeholder": "パスワードを入力",
"auth.submitting": "お待ちください...",
"auth.noAccount": "アカウントをお持ちでないですか?",
"auth.hasAccount": "すでにアカウントをお持ちですか?",

View File

@@ -155,9 +155,9 @@ export const zhCN: TranslationMap = {
"auth.login": "登录",
"auth.register": "注册",
"auth.username": "用户名",
"auth.username.placeholder": "3-64 个字符",
"auth.username.placeholder": "请输入用户名",
"auth.password": "密码",
"auth.password.placeholder": "8-72 个字符",
"auth.password.placeholder": "请输入密码",
"auth.submitting": "请稍候...",
"auth.noAccount": "还没有账号?",
"auth.hasAccount": "已有账号?",