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

     1  -- +goose Up
     2  
     3  ALTER TABLE funding_period_data_points DROP CONSTRAINT IF EXISTS funding_period_data_points_market_id_funding_period_seq_fkey;
     4  
     5  -- +goose StatementBegin
     6  DO $$
     7  BEGIN
     8      IF NOT EXISTS (SELECT * FROM timescaledb_information.hypertables WHERE hypertable_name = 'funding_period_data_points') THEN
     9          PERFORM create_hypertable('funding_period_data_points','vega_time', chunk_time_interval => INTERVAL '1 day');
    10  END IF;
    11  END $$;
    12  -- +goose StatementEnd
    13  
    14  -- +goose Down
    15  
    16  -- do nothing, we want funding_period_data_points to stay a hypertable regardless