From dffa70e2fe02f6ce5c97aedc23e32fd806008e85 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 2 Mar 2024 17:57:43 -0600 Subject: [PATCH] Add missing index on kind-pubkey-created_at --- src/db/migrations/011_kind_author_index.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/db/migrations/011_kind_author_index.ts diff --git a/src/db/migrations/011_kind_author_index.ts b/src/db/migrations/011_kind_author_index.ts new file mode 100644 index 0000000..e894aa3 --- /dev/null +++ b/src/db/migrations/011_kind_author_index.ts @@ -0,0 +1,16 @@ +import { Kysely } from '@/deps.ts'; + +export async function up(db: Kysely): Promise { + await db.schema + .createIndex('idx_events_kind_pubkey_created_at') + .on('events') + .columns(['kind', 'pubkey', 'created_at']) + .execute(); +} + +export async function down(db: Kysely): Promise { + await db.schema + .dropIndex('idx_events_kind_pubkey_created_at') + .on('events') + .execute(); +}