File tree Expand file tree Collapse file tree 2 files changed +4
-20
lines changed Expand file tree Collapse file tree 2 files changed +4
-20
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ export interface MigrationModel {
77}
88
99export interface MigrationStore {
10- init ( options : Record < string , unknown > ) : Promise < void > ;
10+ init ( options : Record < string , unknown > ) : Promise < void > | void ;
1111 getAppliedMigrations ( ) : Promise < MigrationModel [ ] > ;
1212 insertMigration ( migration : Migration ) : Promise < void > ;
1313}
Original file line number Diff line number Diff line change 1- import { Collection , MongoClient , MongoClientOptions } from 'mongodb' ;
1+ import { Collection , Db } from 'mongodb' ;
22
33import { Migration } from './Migration' ;
44import { MigrationModel , MigrationStore } from './MigrationStore' ;
55
66export class MongoMigrationStore implements MigrationStore {
77 private collection ?: Collection < MigrationModel > ;
88
9- async init ( {
10- uri,
11- database,
12- migrationsCollection,
13- options,
14- } : {
15- uri : string ;
16- database : string ;
17- migrationsCollection : string ;
18- options ?: MongoClientOptions ;
19- } ) : Promise < void > {
20- try {
21- const client = await MongoClient . connect ( uri , options ) ;
22- const db = client . db ( database ) ;
23- this . collection = db . collection ( migrationsCollection ) ;
24- } catch ( e ) {
25- throw new Error ( e ) ;
26- }
9+ init ( { db, migrationsCollection } : { db : Db ; migrationsCollection : string } ) : void {
10+ this . collection = db . collection ( migrationsCollection ) ;
2711 }
2812
2913 getAppliedMigrations ( ) : Promise < MigrationModel [ ] > {
You can’t perform that action at this time.
0 commit comments