2020-10-15 12:09:41 -05:00
|
|
|
package deltas
|
|
|
|
|
|
|
|
import (
|
2022-07-25 04:39:22 -05:00
|
|
|
"context"
|
2020-10-15 12:09:41 -05:00
|
|
|
"database/sql"
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
2022-07-25 04:39:22 -05: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 12:09:41 -05:00
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("failed to execute upgrade: %w", err)
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2022-07-25 04:39:22 -05: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 12:09:41 -05:00
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("failed to execute downgrade: %w", err)
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|