|
|
|
|
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.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),
|
|
|
|
|
new(common.ShareActivityCode),
|
|
|
|
|
new(common.ConfigTgRobot),
|
|
|
|
|
new(common.ConfigActivityBetDraw),
|
|
|
|
|
new(common.ActivityBetDrawData),
|
|
|
|
|
new(common.ConfigActivityPopup),
|
|
|
|
|
new(common.SheetBroadcastConfig),
|
|
|
|
|
new(common.SheetNoticeConfig),
|
|
|
|
|
new(common.ConfigDiscountTicket),
|
|
|
|
|
new(common.ConfigRtp),
|
|
|
|
|
new(common.PlayerRtpData),
|
|
|
|
|
new(common.ShareDetail),
|
|
|
|
|
new(common.ConfigShareRankRule),
|
|
|
|
|
new(common.ConfigShareRankReward),
|
|
|
|
|
new(common.ConfigCustomerRobot),
|
|
|
|
|
new(common.CustomerOrderLabel),
|
|
|
|
|
new(common.ConfigCustomer),
|
|
|
|
|
new(common.ConfigRank),
|
|
|
|
|
new(common.ConfigGameClassify),
|
|
|
|
|
new(common.RankData),
|
|
|
|
|
new(common.ConfigGameTag),
|
|
|
|
|
new(common.ConfigShowGameTag),
|
|
|
|
|
new(common.ConfigProviderGameList),
|
|
|
|
|
new(common.WithdrawInfo),
|
|
|
|
|
new(common.ConfigPopUp),
|
|
|
|
|
new(common.ConfigPdd),
|
|
|
|
|
new(common.ConfigLuckyWheel),
|
|
|
|
|
new(common.PddDataNew),
|
|
|
|
|
new(common.PddLotteryHistory),
|
|
|
|
|
new(common.ConfigShareTaskNew),
|
|
|
|
|
new(common.ShareTaskNewData),
|
|
|
|
|
new(common.ConfigShare),
|
|
|
|
|
new(common.ShareRank),
|
|
|
|
|
new(common.ConfigShareLimitTask),
|
|
|
|
|
new(common.ShareLimitTaskData),
|
|
|
|
|
new(common.ShareWithdrawInfo),
|
|
|
|
|
new(common.ConfigShareWithdrawProducts),
|
|
|
|
|
new(common.ConfigShareBanner),
|
|
|
|
|
new(common.ShareRewardData),
|
|
|
|
|
)
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic("Migrate db fail")
|
|
|
|
|
}
|
|
|
|
|
}
|