File tree Expand file tree Collapse file tree 2 files changed +8
-9
lines changed
src/modules/core/infra/database Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Original file line number Diff line number Diff line change 1- import { DataSource , DataSourceOptions } from 'typeorm' ;
1+ import { DataSource } from 'typeorm' ;
22import { dbConfig } from '@core/infra/database/db.config' ;
33import { testConnection } from '@core/infra/database/connection' ;
44import UsersModel from '@core/infra/database/models/Users.model' ;
55import UserPreferencesModel from '@core/infra/database/models/UserPreferences.model' ;
66
77
88async function getConnection ( ) : Promise < DataSource > {
9- const seedConfig : DataSourceOptions = {
10- ...dbConfig ,
11- host : 'localhost' ,
12- entities : [ 'src/modules/core/infra/database/models/**/*.ts' ] ,
13- } as DataSourceOptions ;
14-
15- const connection = new DataSource ( seedConfig ) ;
9+ const connection = new DataSource ( dbConfig ) ;
1610
1711 const isInitialized = await testConnection ( connection , console ) ;
1812
Original file line number Diff line number Diff line change 11import { DataSource , DataSourceOptions } from 'typeorm' ;
22import envsConfig from '@core/configs/envs.config' ;
3+ import UsersModel from './models/Users.model' ;
4+ import UserPreferencesModel from './models/UserPreferences.model' ;
35
46
57function getDialect ( dialect : string ) : 'mysql' | 'postgres' | 'sqlite' | 'mssql' {
@@ -30,7 +32,10 @@ export const dbConfig: DataSourceOptions = {
3032 charset : db . charset ,
3133 timezone : db . timezone ,
3234 logging : app . showExternalLogs ,
33- entities : [ 'build/modules/core/infra/database/models/**/*.js' ] ,
35+ entities : [
36+ UsersModel ,
37+ UserPreferencesModel ,
38+ ] ,
3439 migrations : [ 'build/modules/core/infra/database/migrations/**/*.js' ] ,
3540 subscribers : [ ] ,
3641 pool : {
You can’t perform that action at this time.
0 commit comments