Source code for toardb.contacts.models_person
# SPDX-FileCopyrightText: 2021 Forschungszentrum Jülich GmbH
# SPDX-License-Identifier: MIT
"""
class Person (Base)
===================
"""
from sqlalchemy import Boolean, Column, Integer, String, Sequence, UniqueConstraint, text
from toardb.base import Base
PERSONS_ID_SEQ = Sequence('persons_id_seq') # define sequence explicitly
[docs]class Person(Base):
"""
Table "public.persons"
+-----------+------------------------+-----------+----------+------------------------------------------+
| Column | Type | Collation | Nullable | Default |
+===========+========================+===========+==========+==========================================+
| id | integer | | not null | nextval('persons_id_seq'::regclass) |
+-----------+------------------------+-----------+----------+------------------------------------------+
| name | character varying(64) | | not null | |
+-----------+------------------------+-----------+----------+------------------------------------------+
| email | character varying(128) | | not null | |
+-----------+------------------------+-----------+----------+------------------------------------------+
| phone | character varying(32) | | not null | ''::character varying |
+-----------+------------------------+-----------+----------+------------------------------------------+
| orcid | character varying(19) | | not null | '0000-0002-0309-8010'::character varying |
+-----------+------------------------+-----------+----------+------------------------------------------+
| isprivate | boolean | | not null | false |
+-----------+------------------------+-----------+----------+------------------------------------------+
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)
email = Column(String(128), nullable=False)
phone = Column(String(32), nullable=False, server_default=text("''::character varying"))
orcid = Column(String(19), nullable=False, server_default=text("'0000-0000-0000-0000'::character varying"))
isprivate = Column(Boolean, nullable=False, server_default=text("false"))