Skip to content

Commit

Permalink
bug(core): Fix index type due to knex 2.5.0 changes
Browse files Browse the repository at this point in the history
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 knex/knex#5601 for more information on change.
  • Loading branch information
ukstv committed Jul 10, 2023
1 parent b29b6fc commit ae11dfd
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/core/src/indexing/migrations/1-create-model-table.ts
Expand Up @@ -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'],
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ae11dfd

Please sign in to comment.