-
Notifications
You must be signed in to change notification settings - Fork 881
fix: Order database queries for templates #3249
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
Conversation
Fixes a race in a test where the order of templates varies.
@@ -49,7 +50,9 @@ LIMIT | |||
1; | |||
|
|||
-- name: GetTemplates :many | |||
SELECT * FROM templates; | |||
SELECT * FROM templates | |||
ORDER BY (created_at, id) ASC |
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 wasn't relevant for the test failure, but a bonus fix.
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.
Does the fake db need this too?
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'm guessing not, since they'll be appended to a slice. But I can add it there as well.
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.
Yea, we should explicitly sort to match the sql imo. I do this with a copied slice somewhere else in the fake db where ordering matters.
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.
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.
Thanks for fixing this!
Fixes a race in a test where the order of templates varies.