-- Payment availability controls (D45/D46): a per-rail operational kill switch with a localized message,
-- and a per-account purchase override. Both let an operator disable payments live from the admin —
-- a whole rail/channel, or one account — and explain why to the user on a purchase attempt. Additive
-- (new tables) — applies forward via goose with no data rewrite (no contour wipe); an image rollback
-- ignores both tables. Fail-open by design: a rail with no row is enabled; an account with no row
-- follows the rail switch.
-- +goose Up

CREATE TABLE payments.rail_status (
    rail text PRIMARY KEY,
    enabled boolean NOT NULL DEFAULT true,
    message_ru text NOT NULL DEFAULT '',
    message_en text NOT NULL DEFAULT '',
    updated_at timestamptz NOT NULL DEFAULT now()
);

CREATE TABLE payments.account_payment_override (
    account_id uuid PRIMARY KEY,
    allow boolean NOT NULL,
    updated_at timestamptz NOT NULL DEFAULT now()
);

-- +goose Down

DROP TABLE payments.account_payment_override;
DROP TABLE payments.rail_status;
