fix: 补齐不完整的 v9 商品约束 (#144)

This commit is contained in:
chengma
2026-08-11 11:30:08 +08:00
parent edb835a9ed
commit 9671202f4e
4 changed files with 17 additions and 9 deletions
@@ -468,7 +468,7 @@ func TestMySQLMigrate_V9形状错误不记版本(t *testing.T) {
}
}
func TestMySQLMigrate_已记录V9但缺少SKU来源字段时由V10修复(t *testing.T) {
func TestMySQLMigrate_已记录V9但缺少V8V9结构时由V10修复(t *testing.T) {
db := openMySQLMigrationTestDB(t)
defer db.Close()
cleanMySQLTestSchema(t, db)
@@ -486,6 +486,9 @@ func TestMySQLMigrate_已记录V9但缺少SKU来源字段时由V10修复(t *test
if err := migrateMySQLV9(db); err != nil {
t.Fatal(err)
}
// 同时模拟 v9 已记录但两个图片/店铺人工标记约束尚未建立。
mustExec(t, db, `ALTER TABLE shopee_products DROP CHECK chk_shopee_products_image_manual`)
mustExec(t, db, `ALTER TABLE shopee_products DROP CHECK chk_shopee_products_shop_manual`)
mustExec(t, db, `INSERT INTO schema_migrations(version,applied_at) VALUES
(8,'2026-08-11T00:00:00Z'),(9,'2026-08-11T00:00:00Z')`)