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

SQLite's OR CONFLICT clause for inserts #976

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

vincentiusvin
Copy link

@vincentiusvin vincentiusvin commented May 1, 2024

Hello, I saw the good first issue tag and was interested in giving this a shot.

I implemented the orAbort, orFail, orIgnore, etc methods as discussed in #916, alongside making the SQLite override for ignore().
#510 might be of interest too, since this effectively does what was asked there.

Adding support for update or X should be trivial, but I hope that you won't mind if I keep this PR's scope small.

Still got a few design related questions that you can find downstairs, so I'm drafting this.

Closes #916

Functionality not done, only fix type errors
Figured out this is more WYSIWYG than:
- Having no 'or' as the default for a method called 'orX'
- Appending the 'or' as an override in sqlite-query-compiler
Copy link

vercel bot commented May 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
kysely ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 4, 2024 3:56am

src/operation-node/insert-query-node.ts Outdated Show resolved Hide resolved
src/operation-node/or-conflict-node.ts Outdated Show resolved Hide resolved
src/dialect/mysql/mysql-query-compiler.ts Outdated Show resolved Hide resolved
test/node/src/insert.test.ts Show resolved Hide resolved
@vincentiusvin vincentiusvin changed the title SQLite's OR CONFLICT clause SQLite's OR CONFLICT clause for inserts May 1, 2024
@igalklebanov igalklebanov added enhancement New feature or request sqlite Related to sqlite api Related to library's API labels May 1, 2024
@igalklebanov
Copy link
Member

Adding support for update or X should be trivial, but I hope that you won't mind if I keep this PR's scope small.

Good idea. Let's get insert or X out the door first.

Rename orConflict to orAction
Made the action a string instead of a set of specific strings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Related to library's API enhancement New feature or request sqlite Related to sqlite waiting for submitter response
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[SQLite Dialect] Properly translate .ignore()
2 participants