From 067c582b1f62e44aa44a155f1fc55b1140a9a7da Mon Sep 17 00:00:00 2001 From: Tim Laszlo Date: Fri, 15 Jun 2012 09:31:21 -0500 Subject: DBStats: add unique contraints for entries In the Entries model, name and kind should be unique. --- src/lib/Bcfg2/Server/Reports/reports/models.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/lib/Bcfg2/Server/Reports/reports/models.py b/src/lib/Bcfg2/Server/Reports/reports/models.py index 2ddaba02a..4b078eb2c 100644 --- a/src/lib/Bcfg2/Server/Reports/reports/models.py +++ b/src/lib/Bcfg2/Server/Reports/reports/models.py @@ -312,6 +312,9 @@ class Entries(models.Model): cursor.execute('delete from reports_entries where not exists (select rei.id from reports_entries_interactions rei where rei.entry_id = reports_entries.id)') transaction.set_dirty() + class Meta: + unique_together = ("name", "kind") + class Entries_interactions(models.Model): """Define the relation between the reason, the interaction and the entry.""" -- cgit v1.2.3-1-g7c22