diff --git a/src/app.service.ts b/src/app.service.ts index 2c0037a..1facb05 100644 --- a/src/app.service.ts +++ b/src/app.service.ts @@ -18,7 +18,7 @@ export class AppService { return 'Hello World!'; } - initializeSequelize() { + async initializeSequelize() { this.getModels(); const dbConfig = this.configService.getDbConfig(); if (this.modelFilePaths.length > 0) { @@ -29,13 +29,13 @@ export class AppService { dialect: 'postgres', username: "postgres", password: "FAdDoCwhmi3BvkK4pgEGDc7EspmDtHYV4y93748Xz6VysJKPdlsaU3L9N9k7OD9t", - autoLoadModels: true, // Auto-load model files - synchronize: true, + models: this.modelFilePaths, modelMatch: (filename, member) => { return filename.substring(0, filename.indexOf('.entity')) === member.toLowerCase(); }, }); + await this.commonService.sequelize.sync({ alter: true }); Utility.sequelize = this.commonService.sequelize; } const fileConfig = this.configService.initializeFileSystem();