Initial
This commit is contained in:
31
listify-api/src/database/data-source.ts
Normal file
31
listify-api/src/database/data-source.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import 'dotenv/config';
|
||||
import 'reflect-metadata';
|
||||
import { DataSource } from 'typeorm';
|
||||
import { UserEntity } from '../auth/user.entity';
|
||||
import { RefreshTokenEntity } from '../auth/refresh-token.entity';
|
||||
import { ListTemplateEntity } from '../list-templates/list-template.entity';
|
||||
import { ListTemplateItemEntity } from '../list-templates/list-template-item.entity';
|
||||
import { TemplateSeedEntity } from '../list-templates/template-seed.entity';
|
||||
import { UserListEntity } from '../lists/user-list.entity';
|
||||
import { UserListItemEntity } from '../lists/user-list-item.entity';
|
||||
|
||||
export default new DataSource({
|
||||
type: 'mysql',
|
||||
host: process.env.DB_HOST ?? 'localhost',
|
||||
port: Number(process.env.DB_PORT ?? '3306'),
|
||||
username: process.env.DB_USERNAME ?? 'root',
|
||||
password: process.env.DB_PASSWORD ?? '',
|
||||
database: process.env.DB_DATABASE ?? 'listify',
|
||||
synchronize: false,
|
||||
logging: process.env.DB_LOGGING === 'true',
|
||||
entities: [
|
||||
UserEntity,
|
||||
RefreshTokenEntity,
|
||||
ListTemplateEntity,
|
||||
ListTemplateItemEntity,
|
||||
TemplateSeedEntity,
|
||||
UserListEntity,
|
||||
UserListItemEntity,
|
||||
],
|
||||
migrations: ['src/database/migrations/*.ts'],
|
||||
});
|
||||
Reference in New Issue
Block a user