Create a new table to map a notification to a SMS sender.

There is also some minor db model updates here so that the python db model match the db
This commit is contained in:
Rebecca Law
2017-10-26 15:25:38 +01:00
parent 91b721da4b
commit 4f65ca5447

View File

@@ -324,7 +324,7 @@ class ServiceSmsSender(db.Model):
id = db.Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
sms_sender = db.Column(db.String(11), nullable=False)
service_id = db.Column(UUID(as_uuid=True), db.ForeignKey('services.id'), index=True, nullable=False)
service_id = db.Column(UUID(as_uuid=True), db.ForeignKey('services.id'), index=True, nullable=False, unique=False)
service = db.relationship(Service, backref=db.backref("service_sms_senders", uselist=True))
is_default = db.Column(db.Boolean, nullable=False, default=True)
inbound_number_id = db.Column(UUID(as_uuid=True), db.ForeignKey('inbound_numbers.id'),
@@ -881,7 +881,7 @@ DVLA_RESPONSE_STATUS_SENT = 'Sent'
class NotificationStatusTypes(db.Model):
__tablename__ = 'notification_status_types'
name = db.Column(db.String(255), primary_key=True)
name = db.Column(db.String(), primary_key=True)
class Notification(db.Model):
@@ -1507,3 +1507,24 @@ class NotificationEmailReplyTo(db.Model):
nullable=False,
primary_key=True
)
class NotificationSmsSender(db.Model):
__tablename__ = "notification_to_sms_sender"
notification_id = db.Column(
UUID(as_uuid=True),
db.ForeignKey('notifications.id'),
unique=True,
index=True,
nullable=False,
primary_key=True
)
service_sms_sender_id = db.Column(
UUID(as_uuid=True),
db.ForeignKey('service_sms_senders.id'),
unique=False,
index=True,
nullable=False,
primary_key=True
)