From ae11dfd4fdf62e05ed5b33a60f523903c79e6c15 Mon Sep 17 00:00:00 2001 From: Sergey Ukustov Date: Mon, 10 Jul 2023 18:41:56 +0300 Subject: [PATCH] bug(core): Fix index type due to knex 2.5.0 changes Knex 2.5.0 fixed the behavior of the index type. Previously indices would be created with the default postgres index type of btree. To maintain previous behavior, we need to set all indices to have type of btree rather than hash. See https://github.com/knex/knex/pull/5601 for more information on change. --- .../src/indexing/migrations/1-create-model-table.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/core/src/indexing/migrations/1-create-model-table.ts b/packages/core/src/indexing/migrations/1-create-model-table.ts index 22c79586b1..8c3a1e0783 100755 --- a/packages/core/src/indexing/migrations/1-create-model-table.ts +++ b/packages/core/src/indexing/migrations/1-create-model-table.ts @@ -51,27 +51,27 @@ export function indices(tableName: string): TableIndices { { keys: ['stream_id'], name: `idx_${indexName}_stream_id`, - indexType: 'hash', + indexType: 'btree', }, { keys: ['last_anchored_at'], name: `idx_${indexName}_last_anchored_at`, - indexType: 'hash', + indexType: 'btree', }, { keys: ['first_anchored_at'], name: `idx_${indexName}_first_anchored_at`, - indexType: 'hash', + indexType: 'btree', }, { keys: ['created_at'], name: `idx_${indexName}_created_at`, - indexType: 'hash', + indexType: 'btree', }, { keys: ['updated_at'], name: `idx_${indexName}_updated_at`, - indexType: 'hash', + indexType: 'btree', }, { keys: ['last_anchored_at', 'created_at'], @@ -229,7 +229,7 @@ export async function createConfigTable(dataSource: Knex, tableName: string, net table.string('updated_by', 1024).notNullable() table.index(['is_indexed'], `idx_ceramic_is_indexed`, { - storageEngineIndexType: 'hash', + indexType: 'btree', }) }) break