diff --git a/netbox_branching/models/branches.py b/netbox_branching/models/branches.py index 13dde35..1779157 100644 --- a/netbox_branching/models/branches.py +++ b/netbox_branching/models/branches.py @@ -245,11 +245,11 @@ def sync(self, user, commit=True): try: with activate_branch(self): - with transaction.atomic(): + with transaction.atomic(using=self.connection_name): # Apply each change from the main schema for change in self.get_unsynced_changes().order_by('time'): logger.debug(f'Applying change: {change}') - change.apply() + change.apply(using=self.connection_name) if not commit: raise AbortTransaction()