chore(init): 初始化解忧商行项目并完成 Phase 0 基座
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
package database
|
||||
|
||||
import (
|
||||
"hfb_sys/backend/internal/model"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// MigrateListingLifecycleTestSchema 创建商品生命周期测试所需的共享表结构。
|
||||
// 真实表结构已由 migrations 建好,这里的 AutoMigrate 只做幂等补齐。
|
||||
func MigrateListingLifecycleTestSchema(db *gorm.DB) error {
|
||||
return AutoMigrateIfMissing(db,
|
||||
&model.User{},
|
||||
&model.AdminUser{},
|
||||
&model.GameAccount{},
|
||||
&model.RentalListing{},
|
||||
&model.ListingUpload{},
|
||||
&model.ListingStatusEvent{},
|
||||
&model.DistributionSite{},
|
||||
&model.DistributionSiteAccount{},
|
||||
)
|
||||
}
|
||||
|
||||
// MigrateRentalTransactionTestSchema 在商品生命周期基础上创建订单、支付和交接测试所需的共享表结构。
|
||||
func MigrateRentalTransactionTestSchema(db *gorm.DB) error {
|
||||
if err := MigrateListingLifecycleTestSchema(db); err != nil {
|
||||
return err
|
||||
}
|
||||
return AutoMigrateIfMissing(db,
|
||||
&model.RentalOrder{},
|
||||
&model.SystemConfig{},
|
||||
&model.PaymentOrder{},
|
||||
&model.Notification{},
|
||||
&model.AdminNotification{},
|
||||
&model.HandoffRecord{},
|
||||
&model.OrderCheckout{},
|
||||
&model.WalletAccount{},
|
||||
&model.WalletLedger{},
|
||||
&model.RenterGrowthLedger{},
|
||||
&model.AuditLog{},
|
||||
&model.ProcessEvent{},
|
||||
&model.ChatConversation{},
|
||||
&model.ChatParticipant{},
|
||||
&model.ChatAdminConversationState{},
|
||||
&model.ChatMessage{},
|
||||
)
|
||||
}
|
||||
|
||||
// MigrateRentalDisputeTestSchema 在交易链路基础上创建申诉测试所需的表结构。
|
||||
func MigrateRentalDisputeTestSchema(db *gorm.DB) error {
|
||||
if err := MigrateRentalTransactionTestSchema(db); err != nil {
|
||||
return err
|
||||
}
|
||||
return AutoMigrateIfMissing(db, &model.Dispute{})
|
||||
}
|
||||
Reference in New Issue
Block a user