npm.io
1.0.9 • Published 2 years ago

@types/mongration

Licence
MIT
Version
1.0.9
Deps
2
Size
4 kB
Vulns
0
Weekly
0
Stars
51.4K

Installation

npm install --save @types/mongration

Summary

This package contains type definitions for mongration (https://github.com/awapps/mongration#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mongration.

index.d.ts

import { Db } from "mongodb";

export interface DbConfig {
    hosts?: string | undefined;
    db?: string | undefined;
    user?: string | undefined;
    password?: string | undefined;
    mongoUri?: string | undefined;
    migrationCollection: string;
    replicaSet?: string | undefined;
}

export interface MigrationResponse {
    id: string;
    status: "not-run" | "skipped" | "pending" | "ok" | "error" | "rollback" | "rollback-error";
}

export class Migration {
    constructor(dbConfig: DbConfig);
    add: (paths: string | string[]) => void;
    addAllFromPath: (path: string) => void;
    migrate: (doneCb?: (err: Error | null, response: MigrationResponse[]) => void) => void;
}

export interface MigrationStep {
    id: string;
    up: (db: Db, cb: (err?: Error) => void) => void;
    down?: ((db: Db, cb: (err?: Error) => void) => void) | undefined;
}

Additional Details

Credits

These definitions were written by Anton Lobashev.