hdkv
/
i2_bot
Archived
1
Fork 0
This repository has been archived on 2022-11-04. You can view files and clone it, but cannot push or open issues/pull-requests.
i2_bot/lib/migrations/23_add_user_type.go

30 lines
690 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

// i2_bot Instinct PokememBro Bot
// Copyright (c) 2017 Vladimir "fat0troll" Hodakov
package migrations
import (
// stdlib
"database/sql"
)
// AddUserTypeUp creates `user_type` column in `squads_players` table
func AddUserTypeUp(tx *sql.Tx) error {
_, err := tx.Exec("ALTER TABLE `squads_players` ADD COLUMN `user_type` varchar(191) NOT NULL DEFAULT 'common' COMMENT 'Уровень игрока' AFTER `player_id`;")
if err != nil {
return err
}
return nil
}
// AddUserTypeDown destroys `user_type` column
func AddUserTypeDown(tx *sql.Tx) error {
_, err := tx.Exec("ALTER TABLE `squads_players` DROP COLUMN `user_type`;")
if err != nil {
return err
}
return nil
}