Skip to content
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

chore: Make flow.name column required #3284

Merged
merged 4 commits into from
Jun 19, 2024
Merged

Conversation

DafyddLlyr
Copy link
Contributor

@DafyddLlyr DafyddLlyr commented Jun 18, 2024

What does this PR do?

  • Following on from @RODO94's work to add the flow.name column, this has now been updated to be a required field in the DB, which matches the associated types and expected behaviour
  • Updates a number of tests and functions which required a value for flow.name

Next steps (?)

The reason there's so much "whack-a-mole" with some of these tests is that flow.name and flow.team_id are now really the compound primary key / unique constraints, not flow.slug and flow.team_id. A more robust solution may be to make this change in reality in the database, and to correspondingly update mocks to just have a flow.name value.

Regression tests passing here - https://github.com/theopensystemslab/planx-new/actions/runs/9565438594

@DafyddLlyr DafyddLlyr requested a review from a team June 18, 2024 10:08
Copy link

github-actions bot commented Jun 18, 2024

Removed vultr server and associated DNS entries

@DafyddLlyr DafyddLlyr marked this pull request as draft June 18, 2024 10:33
@DafyddLlyr DafyddLlyr marked this pull request as ready for review June 18, 2024 14:37
Copy link
Contributor

@RODO94 RODO94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All looks good from me

Comment on lines +84 to +85
"INSERT INTO flows (id, slug, name) VALUES ($1, $2, $3) ON CONFLICT DO NOTHING",
[id, id, id],
Copy link
Contributor Author

@DafyddLlyr DafyddLlyr Jun 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was an interesting one - without this I could create a flow, but not update it via ShareDB without an error.

I actually think this like of SQL will never get truly executed (it will always hit the ON CONFLICT clause). This is because the flow is created via Hasura prior to any ShareDB interaction takes place. Postgres must just be "clever enough" to know that this query is incorrect without a name value, despite it never actually being executed. This is why id, id, id is ok as these values are never actually read.

@DafyddLlyr DafyddLlyr merged commit 995dd5c into main Jun 19, 2024
17 checks passed
@DafyddLlyr DafyddLlyr deleted the dp/flow-name-required branch June 19, 2024 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants