Skip to content

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

Merged
merged 25 commits into from
Jun 30, 2023

Conversation

mtojek
Copy link
Member

@mtojek mtojek commented Jun 27, 2023

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 the coder_parameter TF property.

@mtojek mtojek self-assigned this Jun 27, 2023
@mtojek mtojek changed the title 8193 order parameters feat: add "priority" column to coder_parameter to store the ordering Jun 27, 2023
@mtojek mtojek changed the title feat: add "priority" column to coder_parameter to store the ordering feat: add "priority" column to coder_parameter to keep the order Jun 27, 2023
@mtojek mtojek changed the title feat: add "priority" column to coder_parameter to keep the order feat: add "priority" column to coder_parameter to keep the order in UI Jun 27, 2023
@bpmct bpmct mentioned this pull request Jun 28, 2023
4 tasks
@mtojek mtojek changed the title feat: add "priority" column to coder_parameter to keep the order in UI feat: add "order" column to coder_parameter to keep parameters sorted in UI Jun 30, 2023
@mtojek mtojek changed the title feat: add "order" column to coder_parameter to keep parameters sorted in UI feat: add "display_order" column to coder_parameter to keep parameters sorted in UI Jun 30, 2023
@mtojek mtojek requested a review from mafredri June 30, 2023 09:51
@mtojek mtojek marked this pull request as ready for review June 30, 2023 09:51
@mtojek mtojek requested a review from bpmct June 30, 2023 09:51
Copy link
Member

@mafredri mafredri left a 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;
Copy link
Member

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;
Copy link
Member

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. ☺️

@mtojek mtojek merged commit 6639c69 into main Jun 30, 2023
@mtojek mtojek deleted the 8193-order-parameters branch June 30, 2023 10:41
@github-actions github-actions bot locked and limited conversation to collaborators Jun 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

coder_parameter: add "order" DB column to ensure file ordering
2 participants