code.vegaprotocol.io/vega@v0.79.0/datanode/sqlstore/migrations/0040_referral_fees_and_rewards.sql (about) 1 -- +goose Up 2 3 -- referral_fee_stats stores the per-epoch accumulated fees and rewards stats by asset 4 create table if not exists referral_fee_stats ( 5 market_id bytea not null, 6 asset_id bytea not null, 7 epoch_seq bigint not null, 8 total_rewards_paid jsonb not null, 9 referrer_rewards_generated jsonb not null, 10 referees_discount_applied jsonb not null, 11 volume_discount_applied jsonb not null, 12 vega_time timestamp with time zone not null, 13 primary key (vega_time, market_id, asset_id, epoch_seq) 14 ); 15 16 select create_hypertable('referral_fee_stats', 'vega_time', chunk_time_interval => INTERVAL '1 day'); 17 18 -- +goose Down 19 20 drop table if exists referral_fee_stats;