diff options
author | rubenwardy <rw@rubenwardy.com> | 2020-01-18 23:10:11 +0000 |
---|---|---|
committer | rubenwardy <rw@rubenwardy.com> | 2020-01-18 23:10:11 +0000 |
commit | 22d02edbd858649e1c890621d72867d913f8dc57 (patch) | |
tree | fd721e7a045a1108c754ed3758d6ea0aec095dc4 /app/models.py | |
parent | 5a496f68588ac0e7565f386d418c051f57df0c8b (diff) | |
download | cheatdb-22d02edbd858649e1c890621d72867d913f8dc57.tar.xz |
Add constraint for release tasks and approval
Diffstat (limited to 'app/models.py')
-rw-r--r-- | app/models.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/app/models.py b/app/models.py index cd7a88a..3752363 100644 --- a/app/models.py +++ b/app/models.py @@ -732,6 +732,8 @@ class PackageRelease(db.Model): max_rel_id = db.Column(db.Integer, db.ForeignKey("minetest_release.id"), nullable=True, server_default=None) max_rel = db.relationship("MinetestRelease", foreign_keys=[max_rel_id]) + # If the release is approved, then the task_id must be null and the url must be present + CK_approval_valid = db.CheckConstraint("not approved OR (task_id IS NULL AND (url = '') IS NOT FALSE)") def getEditURL(self): return url_for("packages.edit_release", |