Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing record cursor indices #1693

Merged
merged 1 commit into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { Kysely } from 'kysely'

export async function up(db: Kysely<unknown>): Promise<void> {
await db.schema
.createIndex('like_creator_cursor_idx')
.on('like')
.columns(['creator', 'sortAt', 'cid'])
.execute()
await db.schema
.createIndex('follow_creator_cursor_idx')
.on('follow')
.columns(['creator', 'sortAt', 'cid'])
.execute()
await db.schema
.createIndex('follow_subject_cursor_idx')
.on('follow')
.columns(['subjectDid', 'sortAt', 'cid'])
.execute()

// drop old indices that are superceded by these
await db.schema.dropIndex('like_creator_idx').execute()
await db.schema.dropIndex('follow_subjectdid_idx').execute()
}

export async function down(db: Kysely<unknown>): Promise<void> {
await db.schema
.createIndex('like_creator_idx')
.on('like')
.column('creator')
.execute()
await db.schema
.createIndex('follow_subjectdid_idx')
.on('follow')
.column('subjectDid')
.execute()

await db.schema.dropIndex('like_creator_cursor_idx').execute()
await db.schema.dropIndex('follow_creator_cursor_idx').execute()
await db.schema.dropIndex('follow_subject_cursor_idx').execute()
}
1 change: 1 addition & 0 deletions packages/bsky/src/db/migrations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ export * as _20230830T205507322Z from './20230830T205507322Z-suggested-feeds'
export * as _20230904T211011773Z from './20230904T211011773Z-block-lists'
export * as _20230906T222220386Z from './20230906T222220386Z-thread-gating'
export * as _20230920T213858047Z from './20230920T213858047Z-add-tags-to-post'
export * as _20230929T192920807Z from './20230929T192920807Z-record-cursor-indexes'
Loading