diff --git a/types/umzug/index.d.ts b/types/umzug/index.d.ts index aaa9d4e014..0954170b71 100644 --- a/types/umzug/index.d.ts +++ b/types/umzug/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Umzug v1.8.0 +// Type definitions for Umzug v2.0.1 // Project: https://github.com/sequelize/umzug // Definitions by: Ivan Drinchev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -122,7 +122,7 @@ declare namespace umzug { } - interface UpDownToOptions { + interface UpToOptions { /** * It is also possible to pass the name of a migration in order to @@ -133,6 +133,17 @@ declare namespace umzug { } + interface DownToOptions { + + /** + * It is also possible to pass the name of a migration in order to + * just run the migrations from the current state to the passed + * migration name. down allows to pass 0 to revert everything. + */ + to: string | 0; + + } + interface UpDownMigrationsOptions { /** @@ -170,19 +181,19 @@ declare namespace umzug { */ up(migration?: string): Promise; up(migrations?: string[]): Promise; - up(options?: UpDownToOptions | UpDownMigrationsOptions): Promise; + up(options?: UpToOptions | UpDownMigrationsOptions): Promise; /** * The down method can be used to revert the last executed migration. */ down(migration?: string): Promise; down(migrations?: string[]): Promise; - down(options?: UpDownToOptions | UpDownMigrationsOptions): Promise; + down(options?: DownToOptions | UpDownMigrationsOptions): Promise; } interface UmzugStatic { - new (options?: UmzugOptions): Umzug; + new(options?: UmzugOptions): Umzug; } } diff --git a/types/umzug/umzug-tests.ts b/types/umzug/umzug-tests.ts index 650c4fdfbf..b5def394e9 100644 --- a/types/umzug/umzug-tests.ts +++ b/types/umzug/umzug-tests.ts @@ -50,6 +50,8 @@ umzug.down({ migrations: ['20141101203500-task', '20141101203501-task-2'] }); umzug.down('20141101203500-task'); // Runs just the passed migration umzug.down(['20141101203500-task', '20141101203501-task-2']); +umzug.down({to: 0}); // Reverts every migration. + var AnotherUmzug = new Umzug({ // The storage. // Possible values: 'json', 'sequelize', an object