From a8a6df733f9aefc878f5f956ebf05d8beec05feb Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 26 Sep 2024 14:02:07 -0400 Subject: [PATCH] Add oracle prices index on ("marketId", "effectiveAtHeight") (backport #2368) (#2373) Co-authored-by: dydxwill <119354122+dydxwill@users.noreply.github.com> --- ...rices_market_id_effective_at_height_index.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 indexer/packages/postgres/src/db/migrations/migration_files/20240926133526_create_oracle_prices_market_id_effective_at_height_index.ts diff --git a/indexer/packages/postgres/src/db/migrations/migration_files/20240926133526_create_oracle_prices_market_id_effective_at_height_index.ts b/indexer/packages/postgres/src/db/migrations/migration_files/20240926133526_create_oracle_prices_market_id_effective_at_height_index.ts new file mode 100644 index 0000000000..8f80339ebf --- /dev/null +++ b/indexer/packages/postgres/src/db/migrations/migration_files/20240926133526_create_oracle_prices_market_id_effective_at_height_index.ts @@ -0,0 +1,17 @@ +import * as Knex from 'knex'; + +export async function up(knex: Knex): Promise { + await knex.raw(` + CREATE INDEX CONCURRENTLY IF NOT EXISTS "oracle_prices_marketid_effectiveatheight_index" ON "oracle_prices" ("marketId", "effectiveAtHeight"); + `); +} + +export async function down(knex: Knex): Promise { + await knex.raw(` + DROP INDEX CONCURRENTLY IF EXISTS "oracle_prices_marketid_effectiveatheight_index"; + `); +} + +export const config = { + transaction: false, +};