Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
TOAR-II FastAPI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
esde
toar-data
TOAR-II FastAPI
Commits
390133f4
Commit
390133f4
authored
4 years ago
by
Sabine Schröder
Browse files
Options
Downloads
Patches
Plain Diff
#7
: some minor corrections already done; still to carefully check all tables
parent
217b2c47
No related branches found
No related tags found
No related merge requests found
Pipeline
#40519
passed
4 years ago
Stage: deploy
Stage: pages
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
toardb/contacts/models.py
+6
-1
6 additions, 1 deletion
toardb/contacts/models.py
toardb/contacts/models_organisation.py
+2
-2
2 additions, 2 deletions
toardb/contacts/models_organisation.py
toardb/timeseries/models_role.py
+2
-2
2 additions, 2 deletions
toardb/timeseries/models_role.py
with
10 additions
and
5 deletions
toardb/contacts/models.py
+
6
−
1
View file @
390133f4
...
...
@@ -10,7 +10,7 @@ from .models_person import Person
from
.models_organisation
import
Organisation
from
sqlalchemy
import
Table
,
Column
,
Integer
,
String
,
\
ForeignKey
,
text
,
CheckConstraint
,
Sequence
ForeignKey
,
text
,
CheckConstraint
,
UniqueConstraint
,
Sequence
from
sqlalchemy.ext.declarative
import
declarative_base
from
sqlalchemy.orm
import
relationship
...
...
@@ -51,16 +51,21 @@ class Contact(Base):
+-----------------+---------+-----------+----------+----------------------------------------+
Indexes:
"
contacts_pkey
"
PRIMARY KEY, btree (id)
"
contacts_person_id_organisation_id
"
UNIQUE CONSTRAINT, btree (person_id, organisation_id)
Check constraints:
"
ck_contact
"
CHECK (person_id > 0 AND organisation_id = 0 OR person_id = 0 AND organisation_id > 0)
Foreign-key constraints:
"
contacts_organisation_id_fkey
"
FOREIGN KEY (organisation_id) REFERENCES organisations(id)
"
contacts_person_id_fkey
"
FOREIGN KEY (person_id) REFERENCES persons(id)
Referenced by:
TABLE
"
stationmeta_roles
"
CONSTRAINT
"
stationmeta_roles_contact_id_fk_contacts_id
"
FOREIGN KEY (contact_id) REFERENCES contacts(id) DEFERRABLE INITIALLY DEFERRED
TABLE
"
timeseries_roles
"
CONSTRAINT
"
timeseries_roles_contact_id_fk_contacts_id
"
FOREIGN KEY (contact_id) REFERENCES contacts(id) DEFERRABLE INITIALLY DEFERRED
"""
__tablename__
=
'
contacts
'
__table_args__
=
(
CheckConstraint
(
'
((person_id > 0) AND (organisation_id = 0)) OR ((person_id = 0) AND (organisation_id > 0))
'
),
UniqueConstraint
(
'
person_id
'
,
'
organisation_id
'
)
)
id
=
Column
(
Integer
,
primary_key
=
True
,
server_default
=
text
(
"
nextval(
'
contacts_id_seq
'
::regclass)
"
))
...
...
This diff is collapsed.
Click to expand it.
toardb/contacts/models_organisation.py
+
2
−
2
View file @
390133f4
...
...
@@ -17,7 +17,7 @@ class Organisation(Base):
+----------------+------------------------+-----------+----------+-------------------------------------------+
| name | character varying(32) | | not null | |
+----------------+------------------------+-----------+----------+-------------------------------------------+
| longname | character varying(
128
) | | not null | |
| longname | character varying(
256
) | | not null | |
+----------------+------------------------+-----------+----------+-------------------------------------------+
| kind | integer | | not null | |
+----------------+------------------------+-----------+----------+-------------------------------------------+
...
...
@@ -45,7 +45,7 @@ class Organisation(Base):
id
=
Column
(
Integer
,
ORGANISATIONS_ID_SEQ
,
primary_key
=
True
,
server_default
=
ORGANISATIONS_ID_SEQ
.
next_value
())
name
=
Column
(
String
(
32
),
nullable
=
False
)
longname
=
Column
(
String
(
128
),
nullable
=
False
)
longname
=
Column
(
String
(
256
),
nullable
=
False
)
kind
=
Column
(
ForeignKey
(
'
ok_vocabulary.enum_val
'
),
nullable
=
False
)
city
=
Column
(
String
(
64
),
nullable
=
False
)
postcode
=
Column
(
String
(
16
),
nullable
=
False
)
...
...
This diff is collapsed.
Click to expand it.
toardb/timeseries/models_role.py
+
2
−
2
View file @
390133f4
...
...
@@ -34,7 +34,7 @@ class TimeseriesRole(Base):
+---------------+---------+-----------+----------+----------------------------------------------+
Indexes:
"
timeseries_roles_pkey
"
PRIMARY KEY, btree (id)
"
timeseries_roles_role_contact_id_uniq
"
UNIQUE CONSTRAINT, btree (role, contact_id)
"
timeseries_roles_role_
status_
contact_id_uniq
"
UNIQUE CONSTRAINT, btree (role,
status,
contact_id)
"
timeseries_roles_contact_id
"
btree (contact_id)
Check constraints:
"
timeseries_roles_role_check
"
CHECK (role >= 0)
...
...
@@ -47,7 +47,7 @@ class TimeseriesRole(Base):
__table_args__
=
(
CheckConstraint
(
'
role >= 0
'
),
CheckConstraint
(
'
status >= 0
'
),
UniqueConstraint
(
'
role
'
,
'
contact_id
'
)
UniqueConstraint
(
'
role
'
,
'
status
'
,
'
contact_id
'
)
)
id
=
Column
(
Integer
,
TIMESERIES_ROLES_ID_SEQ
,
primary_key
=
True
,
server_default
=
TIMESERIES_ROLES_ID_SEQ
.
next_value
())
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment