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

     1  -- +goose Up
     2  
     3  CREATE TABLE IF NOT EXISTS funding_payment (
     4      market_id BYTEA NOT NULL,
     5      party_id BYTEA NOT NULL,
     6      amount NUMERIC,
     7      funding_period_seq BIGINT NOT NULL,
     8      vega_time TIMESTAMP WITH TIME ZONE NOT NULL,
     9      tx_hash BYTEA NOT NULL,
    10      PRIMARY KEY (party_id, market_id, vega_time)
    11  );
    12  
    13  -- +goose StatementBegin
    14  DO $$
    15  BEGIN
    16      IF NOT EXISTS (SELECT * FROM timescaledb_information.hypertables WHERE hypertable_name = 'funding_payment') THEN
    17          PERFORM create_hypertable('funding_payment','vega_time', chunk_time_interval => INTERVAL '1 day');
    18  END IF;
    19  END $$;
    20  -- +goose StatementEnd
    21  
    22  -- +goose Down
    23  
    24  DROP TABLE IF EXISTS funding_payment cascade;