[usage] Add db.Project model in golang#10368
Conversation
c884749 to
47991a8
Compare
jankeromnes
left a comment
There was a problem hiding this comment.
Many thanks for this PR! Left a few questions in-line for now & will finish this code review later today.
| TeamID sql.NullString `gorm:"column:teamId;type:char;size:36;" json:"teamId"` | ||
| UserID sql.NullString `gorm:"column:userId;type:char;size:36;" json:"userId"` | ||
|
|
||
| MarkedDeleted int32 `gorm:"column:markedDeleted;type:tinyint;default:0;" json:"markedDeleted"` |
There was a problem hiding this comment.
Question: Why use int32 to represent booleans?
- Shouldn't this be a
bool? - SQL's
tinyintis one byte, so this could also beuint8orbyte
There was a problem hiding this comment.
The underlying datatype in MySQL is tinyint it looks like, so here it only matches that. I'll see if using a bool results in similar behaviour.
There was a problem hiding this comment.
I've updated this to bool. It works fine and gives us nicer handling with the model. Great spot!
47991a8 to
5b940b2
Compare
jankeromnes
left a comment
There was a problem hiding this comment.
Many thanks for adjusting! 👍
A few more comments in-line.
Also, how do you run the unit tests?
| Pinned bool `gorm:"column:pinned;type:tinyint;default:0;" json:"pinned"` | ||
|
|
||
| // deleted is reserved for use by db-sync | ||
| _ int32 `gorm:"column:deleted;type:tinyint;default:0;" json:"deleted"` |
There was a problem hiding this comment.
| _ int32 `gorm:"column:deleted;type:tinyint;default:0;" json:"deleted"` | |
| _ bool `gorm:"column:deleted;type:tinyint;default:0;" json:"deleted"` |
There was a problem hiding this comment.
Also,
Workspace.IDandWorkspace.OwnerIDcould be of typeuuid.UUIDWorkspace.Typecould be an enum [1]
There was a problem hiding this comment.
Good spot. I'd like to leave this part for later PRs once we start using the data from the model and come across this. This will guide us exactly how we want to encapsulated the enum model for this.
Co-authored-by: Jan Keromnes <jan.keromnes@typefox.io>
Standard go test. Navigate to the component and do |
Thanks! I took the liberty to clarify the "How to test" instructions in your PR description. 😇 Also, could these eventually be run by Werft, so that we automatically detect new bugs / regressions? 👀 |
|
I tried this -- did I do something wrong?
|
|
@jankeromnes see instructions in the error message. |
The tests are already run by werft :) See raw logs and search for |
|
<3 |
Description
Adds golang model for
d_b_projecttable. Process similar to #10293Related Issue(s)
How to test
Unit tests
Release Notes
Documentation
NONE