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/25_remove_reusable.go

30 lines
679 B
Go
Raw Normal View History

// i2_bot Instinct PokememBro Bot
// Copyright (c) 2017 Vladimir "fat0troll" Hodakov
package migrations
import (
// stdlib
"database/sql"
)
// RemoveReusableUp removes `reusable` field in `orders` table
func RemoveReusableUp(tx *sql.Tx) error {
_, err := tx.Exec("ALTER TABLE `orders` DROP COLUMN `reusable`")
if err != nil {
return err
}
return nil
}
// RemoveReusableDown reverts `reusable` column
func RemoveReusableDown(tx *sql.Tx) error {
_, err := tx.Exec("ALTER TABLE `orders` ADD COLUMN `reusable` bool NOT NULL DEFAULT true COMMENT 'Можно ли повторить приказ' AFTER `scheduled_at")
if err != nil {
return err
}
return nil
}