feat: live module and jenkins pipeline to harbor deploy
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package gift
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"kra/internal/data/ledger"
|
||||
"kra/pkg/database/migration"
|
||||
)
|
||||
|
||||
func Migrations() []migration.Step {
|
||||
return []migration.Step{{ID: "202609190002_gift_schema", Migrate: func(db *gorm.DB) error {
|
||||
if err := migration.CreateMissingTables(db, &giftPO{}, &ledger.GiftSendPO{}); err != nil {
|
||||
return err
|
||||
}
|
||||
var n int64
|
||||
if err := db.Model(&giftPO{}).Count(&n).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
if n > 0 {
|
||||
return nil
|
||||
}
|
||||
return db.Create(&[]giftPO{{Name: "玫瑰", Icon: "🌹", Price: 1, Description: "一朵玫瑰,为主播送上心意", Tiers: "[1,10,66,1314]", Sort: 1, Enabled: true}, {Name: "星星", Icon: "⭐", Price: 10, Description: "点亮一颗星,助力主播上榜", Tiers: "[1,10,66,1314]", Sort: 2, Enabled: true}, {Name: "跑车", Icon: "🚗", Price: 66, Description: "豪车进场,全场焦点", Tiers: "[1,10,66,1314]", Sort: 3, Enabled: true}, {Name: "火箭", Icon: "🚀", Price: 520, Description: "火箭升空,点燃直播间", Tiers: "[1,10,66,520]", Sort: 4, Enabled: true}}).Error
|
||||
}}}
|
||||
}
|
||||
Reference in New Issue
Block a user