-
Notifications
You must be signed in to change notification settings - Fork 1
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
Migrate database to GORM and new schema #8
base: master
Are you sure you want to change the base?
Conversation
d79b75b
to
a4e62e8
Compare
a4e62e8
to
2cf6e37
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.
Some questions and comments. Haven't had the time to review the tests yet.
6b8c45a
to
7843bfb
Compare
f2d54aa
to
48683cf
Compare
48683cf
to
ad9587a
Compare
58d68e6
to
af4e08d
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.
Another round of comments... Can we also add the annotations that set the indexes and constraints to the gorm models?
share/sql/sql.go
Outdated
if m.isProjectAdminFromCtx(ctx, user) { | ||
return "", []interface{}{}, nil | ||
// Now we do the actual update to the db model | ||
switch rs.State { |
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.
Why do we do this in 2 steps instead of doing it in the first switch? It's also because it's making me a bit confused that you can change both state and hidden fileds of a share, but then, the state overwrites the hidden value? Not sure I'm making sense...
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.
The switch rs.State
should indeed be moved up to case "state"
or it will override hidden.
However, I think we have to review some time how we handle the "ShareStates", because now we kind of have double information (we use ShareState_SHARE_STATE_REJECTED
to mean hidden, but even the CS3 API ShareState has a field for Hidden
, so this seems to be redundant)
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.
I remember arguing with the web people at the time about this... the reasoning was that they wanted IIRC:
- accepted (= sync-able) + visible
- accepted + hidden (but still sync-able)
- rejected (and not sync-able)
Now we're adding the sync
as well and there's probably too much redundancy. Let's simplify? -> let's have a quick chat?
As discussed via MM, I would also like to confirm that null values (via manually inserted rows) do not break anything. (or, we just set annotations with the proper sql configs). |
840b0c3
to
e3129e7
Compare
e3129e7
to
265f569
Compare
6995d25
to
1ba26d6
Compare
a817792
to
2bdd798
Compare
Following ADR-Reva-003, this PR refactors the sharing SQL logic to now use GORM, an ORM for Go. This change also comes with newly written unit tests for all the database logic.