From b0872d9466ea50dd0f4bbb684eb090c24845ff1c Mon Sep 17 00:00:00 2001 From: venusbb Date: Thu, 19 Oct 2017 14:15:34 +0100 Subject: [PATCH] add unique service_id&year constraint --- app/models.py | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models.py b/app/models.py index ab8978875..0637293fa 100644 --- a/app/models.py +++ b/app/models.py @@ -187,6 +187,7 @@ class AnnualBilling(db.Model): 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) + UniqueConstraint('financial_year_start', 'service_id', name='ix_annual_billing_service_id') def serialize(self): return {