Rearrange order of Album.delete ops to not void FK contraint.
This commit is contained in:
parent
c736c33165
commit
c930228d3f
1 changed files with 2 additions and 2 deletions
|
@ -399,9 +399,9 @@ class Album(ObjectBase, GroupableMixin):
|
||||||
def delete(self, *, delete_children=False, commit=True):
|
def delete(self, *, delete_children=False, commit=True):
|
||||||
self.photodb.log.debug('Deleting %s', self)
|
self.photodb.log.debug('Deleting %s', self)
|
||||||
GroupableMixin.delete(self, delete_children=delete_children, commit=False)
|
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_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()
|
self._uncache()
|
||||||
if commit:
|
if commit:
|
||||||
self.photodb.log.debug('Committing - delete album')
|
self.photodb.log.debug('Committing - delete album')
|
||||||
|
|
Loading…
Reference in a new issue