# Description of Schema

## Tables

contact
contactprop
contact_relationship

### contact

Top

Comments:
$Id: contact.sql,v 1.5 2007-02-25 17:00:17 briano Exp $
==========================================
Chado contact module
=================================================================
Dependencies:
:import cvterm from cv
=================================================================
================================================
TABLE: contact
================================================
Model persons, institutes, groups, organizations, etc.

Field Name | Data Type | Size | Default Value | Other | Foreign Key
--- | --- | --- | --- | --- | ---
contact_id | integer | 20 |  | PRIMARY KEY, NOT NULL |
type_id | integer | 20 | NULL | What type of contact is this? E.g. "person", "lab". | cvterm.cvterm_id
name | varchar | 255 |  | UNIQUE, NOT NULL |
description | varchar | 255 | NULL |  |

### Constraints

Type | Fields
--- | ---
NOT NULL | contact_id
FOREIGN KEY | type_id
NOT NULL | name
UNIQUE | name

### contactprop

Top

Comments:
================================================
TABLE: contactprop
================================================
A contact can have any number of slot-value property tags attached to it. This is an alternative to hardcoding a list of columns in the relational schema, and is completely extensible.

Field Name | Data Type | Size | Default Value | Other | Foreign Key
--- | --- | --- | --- | --- | ---
contactprop_id | integer | 20 |  | PRIMARY KEY, NOT NULL |
contact_id | integer | 20 |  | UNIQUE, NOT NULL | contact.contact_id
type_id | integer | 20 |  | UNIQUE, NOT NULL | cvterm.cvterm_id
value | text | 64000 |  |  |
rank | integer | 10 | 0 | UNIQUE, NOT NULL |

### Indices

Name | Fields
--- | ---
contactprop_idx1 | contact_id
contactprop_idx2 | type_id

### Constraints

Type | Fields
--- | ---
NOT NULL | contactprop_id
NOT NULL | contact_id
NOT NULL | type_id
NOT NULL | rank
UNIQUE | contact_id, type_id, rank
FOREIGN KEY | contact_id
FOREIGN KEY | type_id

### contact_relationship

Top

Comments:
================================================
TABLE: contact_relationship
================================================
Model relationships between contacts

Field Name | Data Type | Size | Default Value | Other | Foreign Key
--- | --- | --- | --- | --- | ---
contact_relationship_id | integer | 20 |  | PRIMARY KEY, NOT NULL |
type_id | integer | 20 |  | UNIQUE, NOT NULL, Relationship type between subject and object. This is a cvterm, typically from the OBO relationship ontology, although other relationship types are allowed. | cvterm.cvterm_id
subject_id | integer | 20 |  | UNIQUE, NOT NULL, The subject of the subj-predicate-obj sentence. In a DAG, this corresponds to the child node. | contact.contact_id
object_id | integer | 20 |  | UNIQUE, NOT NULL, The object of the subj-predicate-obj sentence. In a DAG, this corresponds to the parent node. | contact.contact_id

### Indices

Name | Fields
--- | ---
contact_relationship_idx1 | type_id
contact_relationship_idx2 | subject_id
contact_relationship_idx3 | object_id

### Constraints

Type | Fields
--- | ---
NOT NULL | contact_relationship_id
NOT NULL | type_id
FOREIGN KEY | type_id
NOT NULL | subject_id
FOREIGN KEY | subject_id
NOT NULL | object_id
FOREIGN KEY | object_id
UNIQUE | subject_id, object_id, type_id

Created by SQL::Translator 0.11020