mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 12:56:46 +08:00
Umzug: custom storage option
This commit is contained in:
33
types/umzug/index.d.ts
vendored
33
types/umzug/index.d.ts
vendored
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/sequelize/umzug
|
||||
// Definitions by: Ivan Drinchev <https://github.com/drinchev>
|
||||
// Margus Lamp <https://github.com/mlamp>
|
||||
// Troy McKinnon <https://github.com/trodi>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -39,10 +40,32 @@ declare namespace umzug {
|
||||
* for examples.
|
||||
*/
|
||||
customResolver?(path: string): { up: () => Promise<any>, down?: () => Promise<any> };
|
||||
|
||||
|
||||
}
|
||||
|
||||
interface JSONStorageOptions {
|
||||
/**
|
||||
* In order to keep track of already executed tasks, umzug logs successfully executed migrations.
|
||||
* This is done in order to allow rollbacks of tasks. This is the interface these `Storages` must
|
||||
* follow.
|
||||
*/
|
||||
interface Storage {
|
||||
/**
|
||||
* Logs migration to be considered as executed.
|
||||
*
|
||||
* @param migrationName - Name of the migration to be logged.
|
||||
*/
|
||||
logMigration(migrationName: string): Promise<void>;
|
||||
/**
|
||||
* Unlogs migration to be considered as pending.
|
||||
*
|
||||
* @param migrationName - Name of the migration to be unlogged.
|
||||
*/
|
||||
unlogMigration(migrationName: string): Promise<void>;
|
||||
/** Gets list of executed migrations. */
|
||||
executed(): Promise<String[]>;
|
||||
}
|
||||
|
||||
interface JSONStorageOptions extends Storage {
|
||||
|
||||
/**
|
||||
* The path to the json storage.
|
||||
@@ -52,7 +75,7 @@ declare namespace umzug {
|
||||
|
||||
}
|
||||
|
||||
interface SequelizeStorageOptions {
|
||||
interface SequelizeStorageOptions extends Storage {
|
||||
|
||||
/**
|
||||
* The configured instance of Sequelize.
|
||||
@@ -99,12 +122,10 @@ declare namespace umzug {
|
||||
}
|
||||
|
||||
interface UmzugOptions {
|
||||
|
||||
/**
|
||||
* The storage.
|
||||
* Possible values: 'json', 'sequelize', an object
|
||||
*/
|
||||
storage?: string;
|
||||
storage?: "json" | "sequelize" | Storage;
|
||||
|
||||
/**
|
||||
* The options for the storage.
|
||||
|
||||
Reference in New Issue
Block a user