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

feat(electric): Prevent updates to table PKs #725

Merged
merged 26 commits into from
Dec 12, 2023

Conversation

magnetised
Copy link
Contributor

No description provided.

Copy link

linear bot commented Dec 5, 2023

@magnetised magnetised marked this pull request as draft December 6, 2023 09:23
@magnetised magnetised force-pushed the garry/vax-1324-prevent-updates-to-table-pks branch from 7c17ae3 to 1aee580 Compare December 6, 2023 09:59
@magnetised magnetised marked this pull request as ready for review December 6, 2023 10:16
Copy link
Member

@alco alco left a comment

Choose a reason for hiding this comment

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

Nice work!

Does this need a matching client-side validation to prevent well-behaving clients from sending updates to PK columns in the first place? If it does, then we should hold off merging this PR at least until after we publish 0.8.x this week.

Also a friendly reminder to add a changeset.

e2e/tests/06.01_prevent_updates_to_pk.lux Outdated Show resolved Hide resolved
components/electric/lib/electric/satellite/protocol.ex Outdated Show resolved Hide resolved
components/electric/lib/electric/satellite/protocol.ex Outdated Show resolved Hide resolved
assert {:ok, ["id", "owner"]} =
SchemaLoader.Version.primary_keys(schema, "public", "compound_pk")

{:ok, schema: schema}
Copy link
Member

Choose a reason for hiding this comment

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

FYI there's no need to return a tagged tuple from setup callbacks. This could simply be %{schema: schema}.

@magnetised magnetised force-pushed the garry/vax-1324-prevent-updates-to-table-pks branch from 7b7059b to 58f9077 Compare December 12, 2023 12:36
@magnetised magnetised merged commit 0dfb35d into main Dec 12, 2023
11 checks passed
@magnetised magnetised deleted the garry/vax-1324-prevent-updates-to-table-pks branch December 12, 2023 13:18
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