You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12 lines
535 B
SQL

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);