Create DailySortedLetter table

The response files we receive from the DVLA when we send letters
contain a row for each letter and a field with a value of 'Unsorted' or
'Sorted'. This table will be used to store the total number of
'Unsorted' and 'Sorted' letter notifications per day.
This commit is contained in:
Katie Smith
2018-02-15 14:27:38 +00:00
parent 271e157d1a
commit b0de3ba4d9
2 changed files with 40 additions and 0 deletions

View File

@@ -1752,3 +1752,13 @@ class StatsTemplateUsageByMonth(db.Model):
'year': self.year,
'count': self.count
}
class DailySortedLetter(db.Model):
__tablename__ = "daily_sorted_letter"
id = db.Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
billing_day = db.Column(db.Date, nullable=False, index=True, unique=True)
unsorted_count = db.Column(db.Integer, nullable=False, default=0)
sorted_count = db.Column(db.Integer, nullable=False, default=0)
updated_at = db.Column(db.DateTime, nullable=True, onupdate=datetime.datetime.utcnow)