Skip to content

fix(core): mutations are non-transactional, leaving orphaned/partial data - #9911

Open
imhayatunnabi wants to merge 1 commit into
keystonejs:mainfrom
imhayatunnabi:fix/core-transaction-mutations
Open

fix(core): mutations are non-transactional, leaving orphaned/partial data#9911
imhayatunnabi wants to merge 1 commit into
keystonejs:mainfrom
imhayatunnabi:fix/core-transaction-mutations

Conversation

@imhayatunnabi

Copy link
Copy Markdown

The Problem I have faced in bulk + large data operations:

create, update, delete and their *Many variants in packages/core/src/lib/core/mutations/index.ts write items
non-transactionally — there is no $transaction anywhere in the mutation path.
Because nested create inputs are persisted before the parent row is written,if the parent write then fails (a validate/beforeOperation hook, a DB constraint, etc.), the already-created related rows are left orphaned in the database with no rollback — the item ends up partially written.
For createMany / updateMany / deleteMany each item is committed independently, so a batch that fails partway leaves earlier items committed and later ones not.

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.

1 participant