Merge pull request #19307 from holgeradam/master

updates umzug types to support reverting all migrations
This commit is contained in:
Bowden Kelly
2017-08-24 17:18:41 -07:00
committed by GitHub
2 changed files with 18 additions and 5 deletions
+16 -5
View File
@@ -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 <https://github.com/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<Migration[]>;
up(migrations?: string[]): Promise<Migration[]>;
up(options?: UpDownToOptions | UpDownMigrationsOptions): Promise<Migration[]>;
up(options?: UpToOptions | UpDownMigrationsOptions): Promise<Migration[]>;
/**
* The down method can be used to revert the last executed migration.
*/
down(migration?: string): Promise<Migration[]>;
down(migrations?: string[]): Promise<Migration[]>;
down(options?: UpDownToOptions | UpDownMigrationsOptions): Promise<Migration[]>;
down(options?: DownToOptions | UpDownMigrationsOptions): Promise<Migration[]>;
}
interface UmzugStatic {
new (options?: UmzugOptions): Umzug;
new(options?: UmzugOptions): Umzug;
}
}
+2
View File
@@ -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