Merge pull request #2450 from alphagov/email-branding-unique-constraint

Update EmailBranding.name to be not null and unique.
This commit is contained in:
Rebecca Law
2019-04-09 14:47:09 +01:00
committed by GitHub
7 changed files with 58 additions and 16 deletions

View File

@@ -6,13 +6,13 @@ post_create_email_branding_schema = {
"type": "object",
"properties": {
"colour": {"type": ["string", "null"]},
"name": {"type": ["string", "null"]},
"name": {"type": "string"},
"text": {"type": ["string", "null"]},
"logo": {"type": ["string", "null"]},
"domain": {"type": ["string", "null"]},
"brand_type": {"enum": BRANDING_TYPES},
},
"required": []
"required": ["name"]
}
post_update_email_branding_schema = {

View File

@@ -219,7 +219,7 @@ class EmailBranding(db.Model):
id = db.Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
colour = db.Column(db.String(7), nullable=True)
logo = db.Column(db.String(255), nullable=True)
name = db.Column(db.String(255), nullable=True)
name = db.Column(db.String(255), unique=True, nullable=False)
text = db.Column(db.String(255), nullable=True)
domain = db.Column(db.Text, unique=True, nullable=True)
brand_type = db.Column(