From 94d98d4e945aef28be7ec19fdb07d121c0ba2ea2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20C=C3=A1rdenas?= Date: Tue, 20 Feb 2024 17:33:49 -0600 Subject: [PATCH] fix: remove unused pg indexes (#311) --- .../1708471015438_remove-unused-indexes.ts | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 migrations/1708471015438_remove-unused-indexes.ts diff --git a/migrations/1708471015438_remove-unused-indexes.ts b/migrations/1708471015438_remove-unused-indexes.ts new file mode 100644 index 00000000..2ba978b7 --- /dev/null +++ b/migrations/1708471015438_remove-unused-indexes.ts @@ -0,0 +1,36 @@ +/* eslint-disable @typescript-eslint/naming-convention */ +import { MigrationBuilder, ColumnDefinitions } from 'node-pg-migrate'; + +export const shorthands: ColumnDefinitions | undefined = undefined; + +export function up(pgm: MigrationBuilder): void { + pgm.dropIndex('locations', ['prev_output']); + pgm.dropIndex('locations', ['address']); + pgm.dropIndex('current_locations', ['block_height']); + pgm.dropIndex('brc20_mints', ['address']); + pgm.dropIndex('brc20_mints', ['block_height']); + pgm.dropIndex('brc20_mints', ['brc20_deploy_id']); + pgm.dropIndex('brc20_transfers', ['to_address']); + pgm.dropIndex('brc20_transfers', ['from_address']); + pgm.dropIndex('brc20_transfers', ['brc20_deploy_id']); + pgm.dropIndex('brc20_transfers', ['block_height']); + pgm.dropIndex('brc20_deploys', ['address']); + pgm.dropIndex('brc20_deploys', ['block_height']); + pgm.dropIndex('inscription_recursions', ['ref_inscription_genesis_id']); +} + +export function down(pgm: MigrationBuilder): void { + pgm.createIndex('locations', ['prev_output']); + pgm.createIndex('locations', ['address']); + pgm.createIndex('current_locations', ['block_height']); + pgm.createIndex('brc20_mints', ['address']); + pgm.createIndex('brc20_mints', ['block_height']); + pgm.createIndex('brc20_mints', ['brc20_deploy_id']); + pgm.createIndex('brc20_transfers', ['to_address']); + pgm.createIndex('brc20_transfers', ['from_address']); + pgm.createIndex('brc20_transfers', ['brc20_deploy_id']); + pgm.createIndex('brc20_transfers', ['block_height']); + pgm.createIndex('brc20_deploys', ['address']); + pgm.createIndex('brc20_deploys', ['block_height']); + pgm.createIndex('inscription_recursions', ['ref_inscription_genesis_id']); +}