From 2b3b67a3afda35431d205f336bfa3cacfc53b564 Mon Sep 17 00:00:00 2001 From: Thomas M Steenholdt Date: Wed, 6 Jun 2018 11:59:15 -0200 Subject: [PATCH] Fix foreign key constraint error on MySQL (cherry picked from commit 2a9108f90482a6be86d0b8af4dfcc30f6651ff28) --- app/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models.py b/app/models.py index c8d4244..f3ad5ac 100644 --- a/app/models.py +++ b/app/models.py @@ -486,7 +486,7 @@ class Account(db.Model): """ account = Account.query.filter(Account.name == account_name).first() if account is None: - return 0 + return None return account.id @@ -664,7 +664,7 @@ class Domain(db.Model): notified_serial = db.Column(db.Integer) last_check = db.Column(db.Integer) dnssec = db.Column(db.Integer) - account_id = db.Column(db.Integer, db.ForeignKey('account.id'), nullable = False) + account_id = db.Column(db.Integer, db.ForeignKey('account.id')) account = db.relationship("Account", back_populates="domains") settings = db.relationship('DomainSetting', back_populates='domain')