Skip to content

Commit 2a2fb8d

Browse files
authored
fix: remove unused indices, add others for re-org queries (#1087)
* fix: add required indices for reorg updates * fix: remove unused indices
1 parent e8200e7 commit 2a2fb8d

File tree

5 files changed

+7
-10
lines changed

5 files changed

+7
-10
lines changed

src/migrations/1588266891631_smart_contracts.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,4 @@ export async function up(pgm: MigrationBuilder): Promise<void> {
5555
pgm.createIndex('smart_contracts', 'index_block_hash', { method: 'hash' });
5656
pgm.createIndex('smart_contracts', 'microblock_hash', { method: 'hash' });
5757
pgm.createIndex('smart_contracts', 'contract_id', { method: 'hash' });
58-
pgm.createIndex('smart_contracts', [
59-
{ name: 'block_height', sort: 'DESC' },
60-
{ name: 'contract_id', sort: 'DESC' },
61-
{ name: 'canonical', sort: 'DESC' },
62-
{ name: 'microblock_canonical', sort: 'DESC' }
63-
]);
6458
}

src/migrations/1605100253938_stx_lock_events.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ export async function up(pgm: MigrationBuilder): Promise<void> {
6262

6363
pgm.createIndex('stx_lock_events', 'tx_id', { method: 'hash' });
6464
pgm.createIndex('stx_lock_events', 'index_block_hash', { method: 'hash' });
65+
pgm.createIndex('stx_lock_events', 'microblock_hash', { method: 'hash' });
6566
pgm.createIndex('stx_lock_events', 'locked_address', { method: 'hash' });
66-
pgm.createIndex('stx_lock_events', 'event_index');
6767
pgm.createIndex('stx_lock_events', [{ name: 'block_height', sort: 'DESC' }]);
6868
pgm.createIndex('stx_lock_events', [{ name: 'unlock_height', sort: 'DESC' }]);
6969
}

src/migrations/1608030374841_namespaces.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ export async function up(pgm: MigrationBuilder): Promise<void> {
9191
},
9292
});
9393

94-
pgm.createIndex('namespaces', 'namespace_id', { method: 'hash' });
94+
pgm.createIndex('namespaces', 'index_block_hash', { method: 'hash' });
95+
pgm.createIndex('namespaces', 'microblock_hash', { method: 'hash' });
9596
pgm.createIndex('namespaces', [{ name: 'ready_block', sort: 'DESC' }]);
9697
}

src/migrations/1608030374842_names.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export async function up(pgm: MigrationBuilder): Promise<void> {
8585

8686
pgm.createIndex('names', 'tx_id', { method: 'hash' });
8787
pgm.createIndex('names', 'name', { method: 'hash' });
88-
pgm.createIndex('names', 'namespace_id', { method: 'hash' });
89-
pgm.createIndex('names', 'zonefile_hash', { method: 'hash' });
88+
pgm.createIndex('names', 'index_block_hash', { method: 'hash' });
89+
pgm.createIndex('names', 'microblock_hash', { method: 'hash' });
9090
pgm.createIndex('names', [{ name: 'registered_at', sort: 'DESC' }]);
9191
}

src/migrations/1610030345948_subdomains.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,5 +87,7 @@ export async function up(pgm: MigrationBuilder): Promise<void> {
8787
pgm.createIndex('subdomains', 'owner', { method: 'hash' });
8888
pgm.createIndex('subdomains', 'zonefile_hash', { method: 'hash' });
8989
pgm.createIndex('subdomains', 'fully_qualified_subdomain', { method: 'hash' });
90+
pgm.createIndex('subdomains', 'index_block_hash', { method: 'hash' });
91+
pgm.createIndex('subdomains', 'microblock_hash', { method: 'hash' });
9092
pgm.createIndex('subdomains', [{ name: 'block_height', sort: 'DESC' }]);
9193
}

0 commit comments

Comments
 (0)