-
Notifications
You must be signed in to change notification settings - Fork 881
feat: add "display_order" column to coder_parameter to keep parameters sorted in UI #8227
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
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 turned out nicely, nice to see a bunch of code removed! 😍
@@ -0,0 +1,4 @@ | |||
ALTER TABLE template_version_parameters ADD COLUMN display_order integer NOT NULL DEFAULT 0; |
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.
It's possible to use a reserved word as a name via quoting, e.g. ADD COLUMN "order"
, but I prefer this approach 👍🏻.
) RETURNING *; | ||
|
||
-- name: GetTemplateVersionParameters :many | ||
SELECT * FROM template_version_parameters WHERE template_version_id = $1; | ||
SELECT * FROM template_version_parameters WHERE template_version_id = $1 ORDER BY display_order ASC, LOWER(name) 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.
Thanks for using explicit ASC
, helps to convey the intent.
Fixes: #8193
This PR implements the "display_order" db column (
ORDER
is a reserved word), which is used to ensure the order of parameters based on thecoder_parameter
TF property.