Archived
1

Latest game update reflections

Added ``pokememes_wealth`` in profiles, because we now can retrieve it
from profiles.
Removed ``pokememe_lvl`` from profile pokememes due to latest game
update, where level calculating become almost impossible (or hard enough
to throw it away).
Added ``pokememe_attack`` for profile pokememes, which will be used
instead of level.
This commit is contained in:
2017-10-22 13:13:20 +04:00
parent c99648b72a
commit 88c9853c77
9 changed files with 98 additions and 28 deletions

View File

@@ -0,0 +1,37 @@
// i2_bot Instinct PokememBro Bot
// Copyright (c) 2017 Vladimir "fat0troll" Hodakov
package migrations
import (
// stdlib
"database/sql"
)
func ChangeProfilePokememesColumnsUp(tx *sql.Tx) error {
_, err := tx.Exec("ALTER TABLE `profiles_pokememes` ADD COLUMN `pokememe_attack` INT(11) NOT NULL DEFAULT 0 COMMENT 'Атака покемема' AFTER `pokememe_id`;;")
if err != nil {
return err
}
_, err = tx.Exec("ALTER TABLE `profiles_pokememes` DROP COLUMN `pokememe_lvl`;")
if err != nil {
return err
}
return nil
}
func ChangeProfilePokememesColumnsDown(tx *sql.Tx) error {
_, err := tx.Exec("ALTER TABLE `profiles_pokememes` ADD COLUMN `pokememe_lvl` INT(11) NOT NULL DEFAULT 0 COMMENT 'Уровень покемема' AFTER `pokememe_id`;;")
if err != nil {
return err
}
_, err = tx.Exec("ALTER TABLE `profiles_pokememes` DROP COLUMN `pokememe_attack`;")
if err != nil {
return err
}
return nil
}

View File

@@ -0,0 +1,27 @@
// i2_bot Instinct PokememBro Bot
// Copyright (c) 2017 Vladimir "fat0troll" Hodakov
package migrations
import (
// stdlib
"database/sql"
)
func AddPokememesWealthUp(tx *sql.Tx) error {
_, err := tx.Exec("ALTER TABLE `profiles` ADD COLUMN `pokememes_wealth` INT(11) NOT NULL DEFAULT 0 COMMENT 'Стоимость покемонов на руках' AFTER `wealth`;")
if err != nil {
return err
}
return nil
}
func AddPokememesWealthDown(tx *sql.Tx) error {
_, err := tx.Exec("ALTER TABLE `profiles` DROP COLUMN `pokememes_wealth`;")
if err != nil {
return err
}
return nil
}

View File

@@ -31,6 +31,8 @@ func (m *Migrations) Init() {
goose.AddNamedMigration("14_fix_time_element.go", FixTimeElementUp, FixTimeElementDown)
goose.AddNamedMigration("15_create_chats.go", CreateChatsUp, CreateChatsDown)
goose.AddNamedMigration("16_change_chat_type_column.go", ChangeChatTypeColumnUp, ChangeChatTypeColumnDown)
goose.AddNamedMigration("17_change_profile_pokememes_columns.go", ChangeProfilePokememesColumnsUp, ChangeProfilePokememesColumnsDown)
goose.AddNamedMigration("18_add_pokememes_wealth.go", AddPokememesWealthUp, AddPokememesWealthDown)
}
func (m *Migrations) Migrate() error {