forked from PinSpace-Org/GistPin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata-source.ts
More file actions
23 lines (21 loc) 路 807 Bytes
/
Copy pathdata-source.ts
File metadata and controls
23 lines (21 loc) 路 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/**
* TypeORM DataSource used by the TypeORM CLI for running migrations.
* Usage:
* npx typeorm -d src/database/data-source.ts migration:run
* npx typeorm -d src/database/data-source.ts migration:generate src/database/migrations/<Name>
*/
import 'dotenv/config';
import { DataSource } from 'typeorm';
import { Gist } from '../gists/entities/gist.entity';
const AppDataSource = new DataSource({
type: 'postgres',
host: process.env.DATABASE_HOST ?? 'localhost',
port: Number(process.env.DATABASE_PORT ?? 5432),
username: process.env.DATABASE_USER ?? 'gist',
password: process.env.DATABASE_PASSWORD ?? 'gist',
database: process.env.DATABASE_NAME ?? 'gist',
entities: [Gist],
migrations: [__dirname + '/migrations/*{.ts,.js}'],
synchronize: false,
});
export default AppDataSource;