-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtypeOrm.sh
28 lines (24 loc) · 910 Bytes
/
typeOrm.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
npm install typeorm reflect-metadata pg
sed -i.bak '
s/\/\/ *"emitDecoratorMetadata": *true,/"emitDecoratorMetadata": true,/g
s/\/\/ *"experimentalDecorators": *true,/"experimentalDecorators": true,/g
s/\/\/ *"lib": *\[\],/"lib": ["ES6"],/g
s/\/\/ *"strictPropertyInitialization": *true,/"strictPropertyInitialization": false,/g
' tsconfig.json && rm tsconfig.json.bak
cat << EOF > src/config/data-source.ts
import { DataSource } from 'typeorm';
export const AppDataSource = new DataSource({
type: 'postgres',
host: 'localhost',
port: 5432,
username: 'postgres',
password: 'postgres',
database: 'new_database', //This database must be created before initialize the typeorm
dropSchema: false, //Erase database content when the server starts
synchronize: true,
logging: false, // Don't log queries in the console
entities: [],
subscribers: [],
migrations: [],
});
EOF