sync method

Future<void> sync(
  1. Iterable<TChild> related, {
  2. bool detaching = true,
})

Makes the pivot match related and nothing else.

Existing extra pivot columns on a key that stays are left alone: sync is about membership, not about wiping unknown attributes. Target rows that drop out of the set are not deleted.

More than one statement always runs inside a transaction, so a failed insert cannot keep a partial detach.

Implementation

Future<void> sync(Iterable<TChild> related, {bool detaching = true}) {
  _requirePivot('sync');
  return _transact((s) => copy(s)._sync(related, detaching: detaching));
}