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

29 lines
629 B
Go
Raw Permalink Normal View History

2017-11-14 03:44:21 +04:00
// i2_bot Instinct PokememBro Bot
// Copyright (c) 2017 Vladimir "fat0troll" Hodakov
package migrations
import (
"database/sql"
)
// ChangeTelegramIDColumnUp changes `telegram_id` column of `chats` table
func ChangeTelegramIDColumnUp(tx *sql.Tx) error {
_, err := tx.Exec("ALTER TABLE `chats` MODIFY `telegram_id` bigint;")
if err != nil {
return err
}
return nil
}
// ChangeTelegramIDColumnDown changes `telegram_id` column of `chats` table
func ChangeTelegramIDColumnDown(tx *sql.Tx) error {
_, err := tx.Exec("ALTER TABLE `chats` MODIFY `telegram_id` bigint;")
if err != nil {
return err
}
return nil
}