Skip to content

Commit

Permalink
types: allow no models argument for automigrate
Browse files Browse the repository at this point in the history
Fix type definitions to allow zero-argument invocation of
the following database migration methods:
  - `DataSource.automigrate()`
  - `DataSource.autoupdate()`

Implementation-wise, when no model names are specified, then ALL models
attached to the datasource are migrated.

Signed-off-by: Miroslav Bajtoš <mbajtoss@gmail.com>
  • Loading branch information
bajtos committed May 12, 2020
1 parent 429d13e commit 4c53aba
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions types/datasource.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,13 @@ export declare class DataSource extends EventEmitter {
*/
attach(modelClass: ModelBaseClass): ModelBaseClass;

automigrate(models: string | string[]): Promise<void>;
automigrate(models?: string | string[]): Promise<void>;
// legacy callback style
automigrate(models: string | string[], callback: Callback): void;
automigrate(models: string | string[] | undefined, callback: Callback): void;

autoupdate(models: string | string[]): Promise<void>;
autoupdate(models?: string | string[]): Promise<void>;
// legacy callback style
autoupdate(models: string | string[], callback: Callback): void;
autoupdate(models: string | string[] | undefined, callback: Callback): void;

discoverModelDefinitions(
options?: Options,
Expand Down

0 comments on commit 4c53aba

Please sign in to comment.