From c930228d3f158d40811ecdf9b4ad43bab40cd368 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sat, 30 Jun 2018 12:51:09 -0700 Subject: [PATCH] Rearrange order of Album.delete ops to not void FK contraint. --- etiquette/objects.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etiquette/objects.py b/etiquette/objects.py index 36a4f50..552d453 100644 --- a/etiquette/objects.py +++ b/etiquette/objects.py @@ -399,9 +399,9 @@ class Album(ObjectBase, GroupableMixin): def delete(self, *, delete_children=False, commit=True): self.photodb.log.debug('Deleting %s', self) GroupableMixin.delete(self, delete_children=delete_children, commit=False) - self.photodb.sql_delete(table='albums', pairs={'id': self.id}) - self.photodb.sql_delete(table='album_photo_rel', pairs={'albumid': self.id}) self.photodb.sql_delete(table='album_associated_directories', pairs={'albumid': self.id}) + self.photodb.sql_delete(table='album_photo_rel', pairs={'albumid': self.id}) + self.photodb.sql_delete(table='albums', pairs={'id': self.id}) self._uncache() if commit: self.photodb.log.debug('Committing - delete album')