migrate_course_sys/README.md
Glore Zeng d76623f59d
Some checks failed
build / build (push) Has been cancelled
feat: migrate course content start time and series price
2026-10-19 22:47:31 +08:00

10 lines
1.2 KiB
Markdown
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.

# 数据库迁移
这些文件是历史增量,不是完整数据库。运行全部迁移前,必须导入经授权的脱敏基础结构,至少存在 `users.teacher`;其他业务表依赖私有 dbtable 模块,也需核对。不要用虚构的 users 表冒充完整初始化。
在上级工作区运行 `./scripts/workspace.ps1 migrate`,使用隔离的本地 MySQL 和 golang-migrate 记录版本。已有数据库须先核对 schema_migrations 与实际结构;禁止盲目 force。已执行的 SQL 不修改,新变更新增时间戳文件。
`node scripts/check-migrations.mjs` 仅检查命名、版本唯一性和非空。SQL 是否可执行须在脱敏基线数据库验证。现有迁移无 down 脚本,生产回退依赖经验证的备份恢复或补偿迁移,不自动回滚。
新增 `1792400000_course_details.up.sql`:为 course 和 course_series 增加 start_time、content_html,系列增加可空独立售价 price(分)。先迁移,再部署对应 API。该版本包含 down 脚本,执行会丢失这些新字段中的数据,必须先备份。历史版本仍无 down 脚本。已在 MySQL 8 临时表验证此版本 up/down;生产完整基线仍需部署前验证。