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

Upsert allowing keys to be excluded #103

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

andrewclink
Copy link

This PR adds exclude: to upsert_options to allow one to leave certain attributes alone during an upsert. The use case is when a column is defined as NOT NULL DEFAULT "something" and an attempt to insert NULL into that column is unwanted.

This includes minimal passing tests.

Ruby 2.3+ is required due to the safe navigation operator being used once. If that's undesirable, an explicit check for nil could be used instead.

@andrewclink
Copy link
Author

This fixes #102

@olleolleolle
Copy link
Collaborator

Regarding the 2.3, the CI only tests 2.4+. We should be good there.

@jesjos
Copy link
Owner

jesjos commented Nov 19, 2022

@andrewclink Can you rebase your branch on the target branch?

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.

3 participants