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

     1  -- +goose Up
     2  
     3  ALTER TABLE IF EXISTS transfer_fees ADD COLUMN discount_applied HUGEINT DEFAULT (0);
     4  
     5  -- transfer_fees_discount table contains the per party, per party available transaction fee discount.
     6  CREATE TABLE IF NOT EXISTS transfer_fees_discount (
     7        party_id bytea NOT NULL,
     8        asset_id bytea NOT NULL,
     9        amount HUGEINT NOT NULL,
    10        epoch_seq BIGINT NOT NULL,
    11        vega_time TIMESTAMP WITH time zone NOT NULL,
    12        PRIMARY KEY (party_id, asset_id, vega_time)
    13  );
    14  
    15  select create_hypertable('transfer_fees_discount', 'vega_time', chunk_time_interval => INTERVAL '1 day');
    16  CREATE INDEX transfer_fees_discount_party_id_idx ON transfer_fees_discount(party_id);
    17  CREATE INDEX transfer_fees_discount_asset_id_idx ON transfer_fees_discount(asset_id);
    18  
    19  -- +goose Down
    20  ALTER TABLE transfer_fees DROP COLUMN discount_applied;
    21  DROP INDEX transfer_fees_discount_party_id_idx;
    22  DROP INDEX transfer_fees_discount_asset_id_idx;
    23  DROP TABLE IF EXISTS transfer_fees_discount;