Skip to content

Commit 2b3c1c9

Browse files
validation only config moved to a separate fn
1 parent 37e169a commit 2b3c1c9

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

lib/models/BaseSequelize.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,23 @@ export abstract class BaseSequelize {
3131

3232
if (config.validateOnly) {
3333

34-
return Object.assign({}, config, {
35-
name: '_name_',
36-
username: '_username_',
37-
password: '_password_',
38-
dialect: 'sqlite',
39-
dialectModulePath: __dirname + '/../utils/db-dialect-dummy'
40-
} as ISequelizeConfig);
34+
return this.getValidationOnlyConfig(config);
4135
}
4236

4337
return config as ISequelizeConfig;
4438
}
4539

40+
static getValidationOnlyConfig(config: ISequelizeConfig | ISequelizeValidationOnlyConfig): ISequelizeConfig {
41+
return {
42+
...config,
43+
name: '_name_',
44+
username: '_username_',
45+
password: '_password_',
46+
dialect: 'sqlite',
47+
dialectModulePath: __dirname + '/../utils/db-dialect-dummy'
48+
} as ISequelizeConfig;
49+
}
50+
4651
addModels(models: Array<typeof Model>): void;
4752
addModels(modelPaths: string[]): void;
4853
addModels(arg: Array<typeof Model | string>): void {

0 commit comments

Comments
 (0)