Add a new data model LETTER_BRANDING to store the letters. Add a new data model SERVICE_LETTER_BRANDING to map the service to the letter brand.

This will replace services.dvla_organisation_id and dvla_organisation.
This commit is contained in:
Rebecca Law
2019-01-17 17:06:01 +00:00
parent f316c1d02b
commit 52a1b534ee
2 changed files with 69 additions and 0 deletions

View File

@@ -249,6 +249,23 @@ class DVLAOrganisation(db.Model):
filename = db.Column(db.String(255), nullable=False)
class LetterBranding(db.Model):
__tablename__ = 'letter_branding'
id = db.Column(UUID(as_uuid=True), primary_key=True)
name = db.Column(db.String(255), unique=True, nullable=False)
filename = db.Column(db.String(255), unique=True, nullable=False)
domain = db.Column(db.Text, unique=True, nullable=True)
service_letter_branding = db.Table(
'service_letter_branding',
db.Model.metadata,
# service_id is a primary key as you can only have one letter branding per service
db.Column('service_id', UUID(as_uuid=True), db.ForeignKey('services.id'), primary_key=True, nullable=False),
db.Column('letter_branding_id', UUID(as_uuid=True), db.ForeignKey('letter_branding.id'), nullable=False),
)
INTERNATIONAL_SMS_TYPE = 'international_sms'
INBOUND_SMS_TYPE = 'inbound_sms'
SCHEDULE_NOTIFICATIONS = 'schedule_notifications'