From 942084fbfd4dffb08053b216d5c3f0ef7a3383b7 Mon Sep 17 00:00:00 2001 From: Joar Wandborg Date: Thu, 27 Sep 2012 11:59:17 +0200 Subject: [PATCH] Added cascade all, delete-orphan to ProcessingMetaData --- mediagoblin/db/sql/models.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/mediagoblin/db/sql/models.py b/mediagoblin/db/sql/models.py index 01694725..b48c1fbe 100644 --- a/mediagoblin/db/sql/models.py +++ b/mediagoblin/db/sql/models.py @@ -22,10 +22,10 @@ TODO: indexes on foreignkeys, where useful. import datetime import sys -from sqlalchemy import ( - Column, Integer, Unicode, UnicodeText, DateTime, Boolean, ForeignKey, - UniqueConstraint, PrimaryKeyConstraint, SmallInteger) -from sqlalchemy.orm import relationship +from sqlalchemy import Column, Integer, Unicode, UnicodeText, DateTime, \ + Boolean, ForeignKey, UniqueConstraint, PrimaryKeyConstraint, \ + SmallInteger +from sqlalchemy.orm import relationship, backref from sqlalchemy.orm.collections import attribute_mapped_collection from sqlalchemy.sql.expression import desc from sqlalchemy.ext.associationproxy import association_proxy @@ -418,7 +418,9 @@ class ProcessingMetaData(Base): id = Column(Integer, primary_key=True) media_entry_id = Column(Integer, ForeignKey(MediaEntry.id), nullable=False, index=True) - media_entry = relationship(MediaEntry, backref='processing_metadata') + media_entry = relationship(MediaEntry, + backref=backref('processing_metadata', + cascade='all, delete-orphan')) callback_url = Column(Unicode) @property -- 2.25.1