-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[db] Add transformer to map MySQL BIGINT to Number, use for Prebuild.statusVersion #9152
Conversation
5c5f50c
to
51a700e
Compare
51a700e
to
befb7b4
Compare
@@ -73,6 +73,7 @@ export class DBPrebuiltWorkspace implements PrebuiltWorkspace { | |||
// statusVersion must only be set by controller/observer. | |||
@Column({ | |||
default: 0, | |||
type: "bigint", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@easyCZ we could leave it an bigint/number and use a transformer to do the conversion from/to DB. see transformers.ts (or typeorm.ts? 🤔 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a great idea! Let me give that a go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This worked! Thanks a lot for suggesting it, I really wasn't happy with the solution I had originally.
/werft run with-clean-slate=true 👍 started the job as gitpod-build-mp-status-version-string.6 |
/werft run with-clean-slate=true 👍 started the job as gitpod-build-mp-status-version-string.8 |
796bd32
to
4dd1e4c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
/unhold |
Description
MySQL serializes the BIGINT type as a string, and without an explicit setting in TypeORM (on global level), it is retrieved as a string.
This PR adds a transformer which converts the retrieved BIGINT as string into a number on the underlying DB object representation.
Before
After
How to test
"message": "Found prebuild record in database.",
, observe thestatusVersion
is a number, rather than a string.Release Notes
Documentation
/uncc
/hold