Skip to content

Commit

Permalink
frontend: Add backref relationship between Package and Build
Browse files Browse the repository at this point in the history
... to silence sqlalchemy warnings
  • Loading branch information
nikromen committed Nov 29, 2023
1 parent e4f544d commit ff8ae32
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions frontend/coprs_frontend/coprs/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -876,8 +876,6 @@ class Package(db.Model, helpers.Serializer, CoprSearchRelatedData):
def validate_max_builds(self, field, value):
return None if value == 0 else value

builds = db.relationship("Build", order_by="Build.id")

# relations
copr_id = db.Column(db.Integer, db.ForeignKey("copr.id"), index=True)
copr = db.relationship("Copr", backref=db.backref("packages"))
Expand Down Expand Up @@ -1064,7 +1062,12 @@ def __init__(self, *args, **kwargs):
copr_id = db.Column(db.Integer, db.ForeignKey("copr.id"), index=True)
copr = db.relationship("Copr", backref=db.backref("builds"))
package_id = db.Column(db.Integer, db.ForeignKey("package.id"), index=True)
package = db.relationship("Package")
package = db.relationship(
"Package",
backref=db.backref("builds"),
foreign_keys=[package_id],
order_by="Build.id",
)

chroots = association_proxy("build_chroots", "mock_chroot")

Expand Down

0 comments on commit ff8ae32

Please sign in to comment.