CREATE TABLE IF NOT EXISTS payments (
    id BIGSERIAL PRIMARY KEY,
    hero_id BIGINT NOT NULL REFERENCES heroes(id) ON DELETE CASCADE,
    type TEXT NOT NULL, -- 'buff_replenish', 'resurrection_replenish'
    buff_type TEXT, -- specific buff type if applicable
    amount_rub INT NOT NULL, -- price in rubles
    status TEXT NOT NULL DEFAULT 'pending', -- pending, completed, failed
    created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
    completed_at TIMESTAMPTZ
);
CREATE INDEX IF NOT EXISTS idx_payments_hero ON payments(hero_id);
