mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 19:49:59 +00:00
Add cascade to Torrent relationships for entry nuking (debugging purposes)
Doesn't change the schema, only how SQA will handle session.delete(Torrent.by_id(1337))
This commit is contained in:
parent
4b4a7b9830
commit
95d2bff614
|
@ -89,10 +89,14 @@ class Torrent(db.Model):
|
||||||
primaryjoin=(
|
primaryjoin=(
|
||||||
"and_(SubCategory.id == foreign(Torrent.sub_category_id), "
|
"and_(SubCategory.id == foreign(Torrent.sub_category_id), "
|
||||||
"SubCategory.main_category_id == Torrent.main_category_id)"))
|
"SubCategory.main_category_id == Torrent.main_category_id)"))
|
||||||
info = db.relationship('TorrentInfo', uselist=False, back_populates='torrent')
|
info = db.relationship('TorrentInfo', uselist=False,
|
||||||
filelist = db.relationship('TorrentFilelist', uselist=False, back_populates='torrent')
|
cascade="all, delete-orphan", back_populates='torrent')
|
||||||
stats = db.relationship('Statistic', uselist=False, back_populates='torrent', lazy='joined')
|
filelist = db.relationship('TorrentFilelist', uselist=False,
|
||||||
trackers = db.relationship('TorrentTrackers', uselist=True, lazy='joined')
|
cascade="all, delete-orphan", back_populates='torrent')
|
||||||
|
stats = db.relationship('Statistic', uselist=False,
|
||||||
|
cascade="all, delete-orphan", back_populates='torrent', lazy='joined')
|
||||||
|
trackers = db.relationship('TorrentTrackers', uselist=True,
|
||||||
|
cascade="all, delete-orphan", lazy='joined')
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return '<{0} #{1.id} \'{1.display_name}\' {1.filesize}b>'.format(type(self).__name__, self)
|
return '<{0} #{1.id} \'{1.display_name}\' {1.filesize}b>'.format(type(self).__name__, self)
|
||||||
|
|
Loading…
Reference in a new issue