Verified Commit 30ab45f4 authored by Kevin Morris's avatar Kevin Morris
Browse files

fix(fastapi): add backref cascade to Package{Keyword,License}


Signed-off-by: Kevin Morris's avatarKevin Morris <kevr@0cost.org>
parent 2b984014
......@@ -13,7 +13,8 @@ class PackageKeyword(Base):
Integer, ForeignKey("PackageBases.ID", ondelete="CASCADE"),
primary_key=True, nullable=True)
PackageBase = relationship(
_PackageBase, backref=backref("keywords", lazy="dynamic"),
_PackageBase, backref=backref("keywords", lazy="dynamic",
cascade="all, delete"),
foreign_keys=[PackageBaseID])
Keyword = Column(
......
......@@ -14,14 +14,16 @@ class PackageLicense(Base):
Integer, ForeignKey("Packages.ID", ondelete="CASCADE"),
primary_key=True, nullable=True)
Package = relationship(
_Package, backref=backref("package_license", uselist=False),
_Package, backref=backref("package_licenses", lazy="dynamic",
cascade="all, delete"),
foreign_keys=[PackageID])
LicenseID = Column(
Integer, ForeignKey("Licenses.ID", ondelete="CASCADE"),
primary_key=True, nullable=True)
License = relationship(
_License, backref=backref("package_license", uselist=False),
_License, backref=backref("package_licenses", lazy="dynamic",
cascade="all, delete"),
foreign_keys=[LicenseID])
__mapper_args__ = {"primary_key": [PackageID, LicenseID]}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment