fix(商品同步): 修复全量同步删除与规则生命周期

This commit is contained in:
Christ committed 2026-08-10 11:21:35 +08:00
1 parent 182cc75e63
commit 9adc77df73
14 files changed
+342 -60

No files matched your search

+7 -2
View File
@@ -33,6 +33,8 @@ func TestMigrate_AppliesCleanSchema(t *testing.T) {
{"cards", "delay_seconds"},
{"keywords", "item_id"},
{"item_info", "multi_quantity_delivery"},
{"item_info", "deleted_at"},
{"automation_rules", "deleted_at"},
{"default_replies", "reply_once"},
{"default_reply_records", "status"},
{"default_reply_records", "text_sent"},
@@ -125,8 +127,8 @@ func TestLatestMigrationsDownUpSQLite(t *testing.T) {
t.Fatalf("goose dialect: %v", err)
}
goose.SetBaseFS(migrationsFS)
// 依次回滚最新版本到 14,再整体升级。
for i := 0; i < 12; i++ {
// 依次回滚最新版本到 13,再整体升级。
for i := 0; i < 13; i++ {
if err := goose.Down(d, "migrations/sqlite"); err != nil {
t.Fatalf("down migration #%d: %v", i+1, err)
}
@@ -146,6 +148,9 @@ func TestLatestMigrationsDownUpSQLite(t *testing.T) {
if columnExists(t, d, "item_publish_batch_rows", "category_json") {
t.Fatal("item_publish_batch_rows.category_json should be removed after migration 23 down")
}
if columnExists(t, d, "item_info", "deleted_at") || columnExists(t, d, "automation_rules", "deleted_at") {
t.Fatal("soft-delete columns should be removed after migration 26 down")
}
for _, table := range []string{"account_task_settings", "account_task_runs", "chat_sessions", "chat_messages"} {
if tableExists(t, d, table) {
t.Fatalf("table should be removed after migration 24 down: %s", table)