2020-10-15 19:09:41 +02:00
|
|
|
package deltas
|
|
|
|
|
|
|
|
import (
|
2022-07-25 11:39:22 +02:00
|
|
|
"context"
|
2020-10-15 19:09:41 +02:00
|
|
|
"database/sql"
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
2022-07-25 11:39:22 +02:00
|
|
|
func UpIsActive(ctx context.Context, tx *sql.Tx) error {
|
|
|
|
_, err := tx.ExecContext(ctx, "ALTER TABLE account_accounts ADD COLUMN IF NOT EXISTS is_deactivated BOOLEAN DEFAULT FALSE;")
|
2020-10-15 19:09:41 +02:00
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("failed to execute upgrade: %w", err)
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2022-07-25 11:39:22 +02:00
|
|
|
func DownIsActive(ctx context.Context, tx *sql.Tx) error {
|
|
|
|
_, err := tx.ExecContext(ctx, "ALTER TABLE account_accounts DROP COLUMN is_deactivated;")
|
2020-10-15 19:09:41 +02:00
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("failed to execute downgrade: %w", err)
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|