create new table annual_billing

This commit is contained in:
venusbb
2017-10-18 15:09:05 +01:00
parent 92b50a26d3
commit b2fa7cdd83
5 changed files with 75 additions and 2 deletions

View File

@@ -1462,3 +1462,23 @@ class NotificationEmailReplyTo(db.Model):
nullable=False,
primary_key=True
)
class AnnualBilling(db.Model):
__tablename__ = "annual_billing"
id = db.Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
service_id = db.Column(UUID(as_uuid=True), db.ForeignKey('services.id'), unique=False, index=True, nullable=False)
financial_year_start = db.Column(db.Integer, nullable=False, default=True)
free_sms_fragment_limit = db.Column(db.Integer, nullable=False, index=False, unique=False)
updated_at = db.Column(db.DateTime, nullable=True, onupdate=datetime.datetime.utcnow)
created_at = db.Column(db.DateTime, nullable=False, default=datetime.datetime.utcnow)
def serialize(self):
return {
'id': str(self.id),
'service_id': str(self.service_id),
'free_sms_fragment_limit': str(self.free_sms_fragment_limit),
'financial_year_start': str(self.financial_year_start),
'created_at': self.created_at.strftime(DATETIME_FORMAT),
'updated_at': self.updated_at.strftime(DATETIME_FORMAT) if self.updated_at else None
}