Add unique constraint to email branding domain

Brandings with a domain set should be considered canonical. It doesn’t
make sense to have the same domain set on multiple different email
brands – you can’t tell which one to use.
This commit is contained in:
Chris Hill-Scott
2018-09-03 16:48:08 +01:00
parent f39f91e0eb
commit f095fa1ddf
2 changed files with 21 additions and 1 deletions

View File

@@ -207,7 +207,7 @@ class EmailBranding(db.Model):
logo = db.Column(db.String(255), nullable=True)
name = db.Column(db.String(255), nullable=True)
text = db.Column(db.String(255), nullable=True)
domain = db.Column(db.Text, nullable=True)
domain = db.Column(db.Text, unique=True, nullable=True)
brand_type = db.Column(
db.String(255),
db.ForeignKey('branding_type.name'),