From 76cc99bb31ff906275f33966f02b38d7a7f4ec52 Mon Sep 17 00:00:00 2001
From: schroeder5 <s.schroeder@fz-juelich.de>
Date: Thu, 9 Jul 2020 19:14:16 +0200
Subject: [PATCH] #7: another minor correction already done; still to carefully
 check all tables

---
 toardb/contacts/models_person.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/toardb/contacts/models_person.py b/toardb/contacts/models_person.py
index 54ce047..b46fc3a 100644
--- a/toardb/contacts/models_person.py
+++ b/toardb/contacts/models_person.py
@@ -25,11 +25,16 @@ class Person(Base):
     +-----------+------------------------+-----------+----------+-------------------------------------+
     Indexes:
         "persons_pkey" PRIMARY KEY, btree (id)
+        "persons_name_email" UNIQUE CONSTRAINT, btree (name, email)
     Referenced by:
         TABLE "station_roles" CONSTRAINT "station_roles_person_id_3bd9c160_fk_persons_id" FOREIGN KEY (person_id) REFERENCES persons(id) DEFERRABLE INITIALLY DEFERRED
         TABLE "timeseries_roles" CONSTRAINT "timeseries_roles_person_id_3e26200e_fk_persons_id" FOREIGN KEY (person_id) REFERENCES persons(id) DEFERRABLE INITIALLY DEFERRED
     """
     __tablename__ = 'persons'
+    __table_args__ = (
+                      UniqueConstraint('name', 'email'),
+                     )
+
 
     id = Column(Integer, PERSONS_ID_SEQ, primary_key=True, server_default=PERSONS_ID_SEQ.next_value())
     name = Column(String(64), nullable=False)
-- 
GitLab