code.vegaprotocol.io/vega@v0.79.0/datanode/sqlstore/migrations/0049_maker_fees_in_fees_stats.sql (about)

     1  -- +goose Up
     2  
     3  alter table fees_stats
     4      add column total_maker_fees_received jsonb not null default '[]';
     5  
     6  alter table fees_stats
     7      add column maker_fees_generated jsonb not null default '[]';
     8  
     9  alter table fees_stats
    10      rename column total_rewards_paid TO total_rewards_received;
    11  
    12  create table if not exists fees_stats_by_party
    13  (
    14      market_id                 bytea                    not null,
    15      asset_id                  bytea                    not null,
    16      party_id                  bytea                    not null,
    17      epoch_seq                 bigint                   not null,
    18      total_rewards_received    hugeint                  not null,
    19      referees_discount_applied hugeint                  not null,
    20      volume_discount_applied   hugeint                  not null,
    21      total_maker_fees_received hugeint                  not null,
    22      vega_time                 timestamp with time zone not null,
    23      PRIMARY KEY (party_id, market_id, asset_id, vega_time)
    24  );
    25  
    26  drop index if exists fees_stats_by_party_market_party;
    27  
    28  create index fees_stats_by_party_market_party on fees_stats_by_party
    29      using btree (party_id, asset_id);
    30  
    31  -- +goose Down
    32  
    33  alter table fees_stats
    34      drop column total_maker_fees_received;
    35  
    36  alter table fees_stats
    37      drop column maker_fees_generated;
    38  
    39  alter table fees_stats
    40      rename column total_rewards_received TO total_rewards_paid;
    41  
    42  drop table if exists fees_stats_by_party;