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 00000000..e894aa36 --- /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(); +}