Skip to content

Commit

Permalink
cascade Badge model toward Challenge
Browse files Browse the repository at this point in the history
Signed-off-by: smallkirby <ssmallkirby@gmail.com>
  • Loading branch information
smallkirby committed Oct 24, 2023
1 parent f3c93cd commit 881f507
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion badge/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

class Badges(db.Model):
id = db.Column(db.Integer, primary_key=True)
challenge = db.Column(db.Integer, db.ForeignKey("challenges.id"), nullable=False)
challenge = db.Column(
db.Integer, db.ForeignKey("challenges.id", ondelete="CASCADE"), nullable=False
)
url = db.Column(db.String(256), nullable=True)

def __init__(self, challenge, url):
Expand Down

0 comments on commit 881f507

Please sign in to comment.