Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typeorm updation #1606

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
7892463
Removing typedi-typeorm-extensions and updating typeorm
VivekFitkariwala May 12, 2024
8c62634
Updating syntax in the code and fixing integration test cases
VivekFitkariwala May 19, 2024
e478009
Reverting typedi 0.10.0 -> 0.8.0
VivekFitkariwala May 25, 2024
d95ffc7
Fixing Controller and Service unit test cases. Adding sample Reposito…
VivekFitkariwala May 26, 2024
442680d
updated lint errors
Jun 4, 2024
5a2c73f
update repository depricated code
Jun 10, 2024
c441ab4
updated all test cases
Jun 10, 2024
35e8709
Solved clearData testcases
Jun 11, 2024
2ecf865
solve multiple repository called testcases
Jun 12, 2024
3fcd3d0
solved remaining logRepo testcases
Jun 12, 2024
cb163d0
Update orUpdate method parameters in repository files
Jun 12, 2024
c6b15e7
Merge branch 'dev' into upgrade/1282-typeorm
Jun 12, 2024
f254123
solve global.ts errors
Jun 13, 2024
9ea7d2d
solved segment failing delete function
Jun 13, 2024
ea21f5c
Merge branch 'dev' into upgrade/1282-typeorm
Jun 14, 2024
53f1771
update deprecated function in analytics
Jun 14, 2024
dcc9fee
Solved import exp not working
Jun 14, 2024
e1f733f
Fixing type
VivekFitkariwala Jun 14, 2024
6da36d4
Merge branch 'upgrade/1282-typeorm' of github.com:CarnegieLearningWeb…
VivekFitkariwala Jun 14, 2024
37e5414
Merge branch 'dev' of https://github.com/CarnegieLearningWeb/UpGrade …
ppratikcr7 Jun 24, 2024
e5566ec
solve typerorm changes for repo and export(cherry picked from commit …
Jun 17, 2024
f678bf0
resolve test cases
ppratikcr7 Jun 24, 2024
c969037
solve failing feature-flag testcases
Jun 25, 2024
851a2c8
Updating model
VivekFitkariwala Jun 25, 2024
18d0244
Adding export connection
VivekFitkariwala Jun 19, 2024
b2d4d95
Merge branch 'dev' of https://github.com/CarnegieLearningWeb/UpGrade …
ppratikcr7 Jun 25, 2024
3595a59
adding separate env variable for export replica and generic replicas
ppratikcr7 Jun 25, 2024
c275654
added entities and migration imports
Jun 26, 2024
d5e650c
making common array for entities and migrations
Jun 27, 2024
521ffac
solve migration errors
Jun 30, 2024
8d1d8c5
Merge branch 'dev' of https://github.com/CarnegieLearningWeb/UpGrade …
ppratikcr7 Jul 16, 2024
8b32f28
removed unwanted code
Jul 17, 2024
ce16d2f
Merge branch 'upgrade/1282-typeorm' of https://github.com/CarnegieLea…
Jul 17, 2024
56e8bb4
fix for export csv not working due to uuid type match
ppratikcr7 Jul 18, 2024
92d7893
fix for experiments with metrics not getting created with test case u…
ppratikcr7 Jul 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backend/packages/Upgrade/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ LOG_OUTPUT=dev
#
TYPEORM_CONNECTION=postgres
TYPEORM_HOST=localhost
TYPEORM_HOSTNAME_EXPORT_REPLICA=[]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the separate new env var needed for the typeorm update? does it need to be an array if it's just one thing?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it was part of improvement we found while updating replica connection syntax during this PR. Its kept as an array for consistency with the other replica hostnames var. We can make it a string if you want.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, this complicates promoting this to production as it's an unexpected configuration change that I don't remember being talked about. @bcb37 @VivekFitkariwala what do you think

TYPEORM_HOSTNAME_REPLICAS=[]
TYPEORM_PORT=5432
TYPEORM_USERNAME=postgres
Expand Down
209 changes: 112 additions & 97 deletions backend/packages/Upgrade/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 6 additions & 7 deletions backend/packages/Upgrade/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
"seed": "npm start db.seed",
"drop": "npm start db.drop",
"help": "npm start help",
"migration:generate": "./node_modules/.bin/ts-node -r tsconfig-paths/register ./node_modules/.bin/typeorm migration:generate -n",
"migration:create": "./node_modules/.bin/ts-node -r tsconfig-paths/register ./node_modules/.bin/typeorm migration:create -n",
"migration:run": "./node_modules/.bin/ts-node -r tsconfig-paths/register ./node_modules/.bin/typeorm migration:run",
"migration:generate": "./node_modules/.bin/ts-node -r tsconfig-paths/register ./node_modules/.bin/typeorm migration:generate -d src/loaders/typeormLoader.ts",
"migration:create": "./node_modules/.bin/ts-node -r tsconfig-paths/register ./node_modules/.bin/typeorm migration:create -d src/loaders/typeormLoader.ts",
"migration:run": "./node_modules/.bin/ts-node -r tsconfig-paths/register ./node_modules/.bin/typeorm migration:run -d src/loaders/typeormLoader.ts",
"migration:revert": "./node_modules/.bin/ts-node -r tsconfig-paths/register ./node_modules/.bin/typeorm migration:revert"
},
"keywords": [],
Expand Down Expand Up @@ -53,7 +53,7 @@
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"tslib": "^2.3.1",
"typeorm-seeding": "^1.2.0"
"typeorm-seeding": "^1.6.1"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.485.0",
Expand All @@ -64,7 +64,7 @@
"@golevelup/ts-jest": "^0.4.0",
"@nestjs/common": "^10.3.0",
"@nestjs/testing": "^10.3.0",
"@nestjs/typeorm": "^10.0.1",
"@nestjs/typeorm": "^10.0.2",
"@types/supertest": "^6.0.2",
"body-parser": "^1.20.1",
"cache-manager": "^5.3.2",
Expand Down Expand Up @@ -107,8 +107,7 @@
"swagger-ui-express": "^5.0.0",
"ts-jest": "^29.1.1",
"typedi": "^0.8.0",
"typeorm": "^0.2.20",
"typeorm-typedi-extensions": "^0.4.1",
"typeorm": "^0.3.20",
"typescript": "^5.3.3",
"uuid": "^9.0.1",
"winston": "^3.2.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ export class ExperimentClientController {
@Delete('clearDB')
public async clearDB(@Req() request: AppRequest): Promise<string> {
// if DEMO mode is enabled, then clear the database:
if (env.app.demo) {
if (!env.app.demo) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this change?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove. i have to assume someone was doing this in debugging and accidentally committed it, if this change snuck into prod, anyone with a token would be able to delete our database by doing DELETE /clearDB. It makes me nervous even having this endpoint exist in the first place for this exact reason.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code updated

await this.experimentUserService.clearDB(request.logger);
return 'DB truncate successful';
}
Expand Down
Loading
Loading