ORM-22: Add attach, detach and sync for many-to-many #22
Labels
No labels
area:core
area:database
area:migrations
area:model
area:relations
area:schema
area:tests
breaking-change
size:M
size:S
tracking
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
NoctisWolfshadow/tessera-orm#22
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Depends on: #8, #21
Context
Writes to a many-to-many relation only touch the pivot table. They are idempotent (the pivot has a composite primary key) and
syncis atomic.Tasks
attach(&b)andattach_many(&[&B])useINSERT OR IGNORE INTO <pivot>so repeating is idempotent.detach(&b)anddetach_all().sync(&[i64])diffs against the current pivot rows and applies the inserts and deletes inside oneDatabase::transaction.Error::NotPersisted.Example
Acceptance criteria
detachremoves it.syncadds and removes the right ids and leaves unchanged ones alone.syncleaves the pivot unchanged.NotPersisted.