Skip to content

Commit

Permalink
fix(service): add this context to mongodb migration functions
Browse files Browse the repository at this point in the history
  • Loading branch information
restjohn committed Sep 23, 2024
1 parent e6988d7 commit 422e6d5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions service/src/@types/mongodb-migrations/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare module '@ngageoint/mongodb-migrations' {

import { MongoClientOptions } from 'mongodb'
import { MongoClientOptions, Db } from 'mongodb'
export { MongoClientOptions } from 'mongodb'

export class Migrator {
Expand Down Expand Up @@ -74,10 +74,15 @@ declare module '@ngageoint/mongodb-migrations' {
options?: MongoClientOptions
}

export type MigrationContext = {
db: Db
log: Console
}

export interface Migration {
id: string
up?: (callback: (err: any) => any) => any
down?: (callback: (err: any) => any) => any
up?: (this: MigrationContext, callback: (err: any) => any) => any
down?: (this: MigrationContext, callback: (err: any) => any) => any
}

export interface MigrationResult {
Expand Down

0 comments on commit 422e6d5

Please sign in to comment.