File tree Expand file tree Collapse file tree 5 files changed +16
-3
lines changed Expand file tree Collapse file tree 5 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,13 @@ DB_PASSWORD = dbpassword;
78
78
79
79
If you want to change or update any code you can just make the change and from the console you will see that the server is getting updated.
80
80
81
+
82
+ ### Run migration in docker
83
+
84
+ ``` sh
85
+ docker-compose exec comm-tool-api npm run migration:create src/database/migration/user
86
+ ```
87
+
81
88
### Run without docker
82
89
83
90
If you don't use Docker then you will get an exception specifying you don't have any database.
Original file line number Diff line number Diff line change 14
14
"prepare" : " husky install" ,
15
15
"test:dev" : " jest --runInBand --watchAll --no-cache" ,
16
16
"test" : " jest --runInBand --no-cache" ,
17
+ "typeorm" : " typeorm-ts-node-commonjs -d ./src/DataSource.ts" ,
18
+ "migration:generate" : " npm run typeorm migration:generate" ,
19
+ "migration:show" : " npm run typeorm migration:show" ,
20
+ "migration:run" : " npm run typeorm migration:run" ,
21
+ "migration:revert" : " npm run typeorm migration:revert" ,
22
+ "migration:create" : " typeorm-ts-node-commonjs migration:create" ,
17
23
"pre-commit" : " lint-staged"
18
24
},
19
25
"jest" : {
Original file line number Diff line number Diff line change @@ -16,4 +16,4 @@ const config: DataSourceOptions = {
16
16
17
17
const AppDataSource = new DataSource ( config ) ;
18
18
19
- export { AppDataSource , config } ;
19
+ export default AppDataSource ;
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import ErrorHandler from './middlewares/ErrorHandler';
2
2
import Config from './config/Config' ;
3
3
import http from 'http' ;
4
4
import { AppLogger } from './utils/Logger' ;
5
- import { AppDataSource } from './DataSource' ;
5
+ import AppDataSource from './DataSource' ;
6
6
import { app } from './app' ;
7
7
const PORT = Config . port || 4000 ;
8
8
Original file line number Diff line number Diff line change 1
1
import request from 'supertest' ;
2
2
import { app } from '../../app' ;
3
3
import { User } from '../../entity/User' ;
4
- import { AppDataSource } from '../../DataSource' ;
4
+ import AppDataSource from '../../DataSource' ;
5
5
6
6
const userRepo = AppDataSource . getRepository ( User ) ;
7
7
You can’t perform that action at this time.
0 commit comments