You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
117 lines
3.4 KiB
117 lines
3.4 KiB
|
1 year ago
|
package backend
|
||
|
|
|
||
|
|
import (
|
||
|
|
"fmt"
|
||
|
|
"server/common"
|
||
|
|
"server/db"
|
||
|
|
)
|
||
|
|
|
||
|
|
// MigrateDB 自动数据库迁移
|
||
|
|
func MigrateDB() {
|
||
|
|
for i := 0; i < 100; i++ {
|
||
|
|
bt := new(common.CurrencyBalance)
|
||
|
|
if err := db.Mysql().C().Table(fmt.Sprintf("currency_balance_%02d", i)).AutoMigrate(bt); err != nil {
|
||
|
|
panic("Migrate db fail")
|
||
|
|
}
|
||
|
|
}
|
||
|
|
for i := common.CurrencyTypeZero + 1; i < common.CurrencyAll; i++ {
|
||
|
|
re := new(common.RechargeInfoCurrency)
|
||
|
|
if err := db.Mysql().C().Table(fmt.Sprintf("recharge_info_%s", i.GetCurrencyName())).AutoMigrate(re); err != nil {
|
||
|
|
panic("Migrate db fail")
|
||
|
|
}
|
||
|
|
}
|
||
|
|
for i := common.CurrencyTypeZero + 1; i < common.CurrencyAll; i++ {
|
||
|
|
pp := new(common.PlayerProfile)
|
||
|
|
if err := db.Mysql().C().Table(fmt.Sprintf("player_profile_%s", i.GetCurrencyName())).AutoMigrate(pp); err != nil {
|
||
|
|
panic("Migrate db fail")
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if err := db.Mysql().C().Table(common.PlayerRechargeTableName).AutoMigrate(&common.PlayerCurrency{}); err != nil {
|
||
|
|
panic("Migrate db fail")
|
||
|
|
}
|
||
|
|
err := db.Mysql().C().AutoMigrate(
|
||
|
|
new(common.PlayerDBInfo),
|
||
|
|
new(common.RechargeOrder),
|
||
|
|
new(common.WithdrawOrder),
|
||
|
|
new(common.RechargeInfo),
|
||
|
|
new(common.Channel),
|
||
|
|
new(common.LoginRecord),
|
||
|
|
new(common.PayInfo),
|
||
|
|
new(common.ConfigPlatform),
|
||
|
|
new(common.ServerVersion),
|
||
|
|
new(common.ConfigRWPer),
|
||
|
|
new(common.PlayerData),
|
||
|
|
new(common.Mail),
|
||
|
|
new(common.PlayerRed),
|
||
|
|
new(common.ConfigActivity),
|
||
|
|
new(common.Jackpot),
|
||
|
|
new(common.ConfigPayProduct),
|
||
|
|
new(common.ConfigWithdrawChannels),
|
||
|
|
new(common.BlackList),
|
||
|
|
new(common.PlayerItems),
|
||
|
|
new(common.ConfigPayChannels),
|
||
|
|
new(common.ConfigH5),
|
||
|
|
new(common.PlayerH5Data),
|
||
|
|
new(common.ConfigTron),
|
||
|
|
new(common.ConfigWithdrawProduct),
|
||
|
|
new(common.ConfigGameProvider),
|
||
|
|
new(common.ConfigGameList),
|
||
|
|
new(common.ConfigGameType),
|
||
|
|
new(common.ConfigGameMark),
|
||
|
|
new(common.ConfigFirstPageGames),
|
||
|
|
new(common.PlayerCurrency),
|
||
|
|
new(common.PlayerProfile),
|
||
|
|
new(common.VipData),
|
||
|
|
new(common.ConfigVIP),
|
||
|
|
new(common.ConfigBroadcast),
|
||
|
|
new(common.ConfigNotice),
|
||
|
|
new(common.ProviderBetRecord),
|
||
|
|
new(common.ConfigCurrencyRateUSD),
|
||
|
|
new(common.TronData),
|
||
|
|
new(common.ConfigGameRoom),
|
||
|
|
new(common.ConfigWater),
|
||
|
|
new(common.ConfigRobot),
|
||
|
|
new(common.ConfigAppSpin),
|
||
|
|
new(common.ConfigShare),
|
||
|
|
new(common.ConfigShareSys),
|
||
|
|
new(common.ShareInfo),
|
||
|
|
new(common.ShareOrder),
|
||
|
|
new(common.ConfigActivityPddSpin),
|
||
|
|
new(common.ConfigActivityPdd),
|
||
|
|
new(common.PddData),
|
||
|
|
new(common.ConfigTask),
|
||
|
|
new(common.TaskData),
|
||
|
|
new(common.PlayerADData),
|
||
|
|
new(common.ConfigCurrencyResource),
|
||
|
|
new(common.ConfigFirstPay),
|
||
|
|
new(common.PlayerPayData),
|
||
|
|
new(common.ConfigActivityFreeSpin),
|
||
|
|
new(common.ActivityFreeSpinData),
|
||
|
|
new(common.ConfigActivityFirstRechargeBack),
|
||
|
|
new(common.ActivityFirstRechargeBackData),
|
||
|
|
new(common.ConfigActivityLuckyCode),
|
||
|
|
new(common.ActivityLuckyCodeData),
|
||
|
|
new(common.ActivityLuckyCode),
|
||
|
|
new(common.ConfigBanner),
|
||
|
|
new(common.ConfigActivitySign),
|
||
|
|
new(common.ActivitySignData),
|
||
|
|
new(common.ConfigActivityBreakGift),
|
||
|
|
new(common.ConfigShareRobot),
|
||
|
|
new(common.ConfigActivityWeekCard),
|
||
|
|
new(common.ActivityWeekCardData),
|
||
|
|
new(common.ConfigActivitySlots),
|
||
|
|
new(common.ActivitySlotsData),
|
||
|
|
new(common.ActivitySlotsRecord),
|
||
|
|
new(common.ConfigActivityLuckyShop),
|
||
|
|
new(common.ActivityLuckyShopData),
|
||
|
|
new(common.ConfigServerFlag),
|
||
|
|
new(common.ConfigActivitySevenDayBox),
|
||
|
|
new(common.ActivitySevenDayBoxData),
|
||
|
|
new(common.ConfigActivitySuper),
|
||
|
|
new(common.ActivitySuperData),
|
||
|
|
)
|
||
|
|
if err != nil {
|
||
|
|
panic("Migrate db fail")
|
||
|
|
}
|
||
|
|
}
|