diff options
author | Tim Laszlo <tim.laszlo@gmail.com> | 2012-06-15 09:31:21 -0500 |
---|---|---|
committer | Tim Laszlo <tim.laszlo@gmail.com> | 2012-06-15 09:31:21 -0500 |
commit | 067c582b1f62e44aa44a155f1fc55b1140a9a7da (patch) | |
tree | 818863bbf4e9169621db80a17573d80feee423b8 /src/lib | |
parent | c09f4ba5fdd5fbbdfb97b95840cb9dd214cca733 (diff) | |
download | bcfg2-067c582b1f62e44aa44a155f1fc55b1140a9a7da.tar.gz bcfg2-067c582b1f62e44aa44a155f1fc55b1140a9a7da.tar.bz2 bcfg2-067c582b1f62e44aa44a155f1fc55b1140a9a7da.zip |
DBStats: add unique contraints for entries
In the Entries model, name and kind should be unique.
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Bcfg2/Server/Reports/reports/models.py | 3 |
1 files changed, 3 insertions, 0 deletions
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.""" |