Project

General

Profile

« Previous | Next » 

Revision 57130

View differences:

schema.sql
11 11
DROP TABLE IF EXISTS organizations;
12 12
DROP TABLE IF EXISTS org_types;
13 13
DROP TABLE IF EXISTS id_types;
14
DROP TABLE IF EXISTS rel_types;
15
DROP TABLE IF EXISTS simrel_types;
16 14
DROP TABLE IF EXISTS languages;
17 15
DROP TABLE IF EXISTS countries;
18 16

  
......
22 20
CREATE TABLE id_types (val text PRIMARY KEY);
23 21
INSERT INTO id_types VALUES ('CNRS'), ('FundRef'), ('HESA'), ('ISNI'), ('OrgRef'), ('UCAS'), ('UKPRN'), ('Wikidata'), ('grid.ac');
24 22

  
25
CREATE TABLE rel_types (val text PRIMARY KEY);
26
INSERT INTO rel_types VALUES ('Child'), ('Parent'), ('Related'), ('Other');
27

  
28
CREATE TABLE simrel_types (val text PRIMARY KEY);
29
INSERT INTO simrel_types VALUES ('suggested'), ('is_similar'), ('is_different');
30

  
31 23
CREATE TABLE languages (val text PRIMARY KEY);
32 24
INSERT INTO languages VALUES ('UNKNOWN'), ('aa'), ('af'), ('am'), ('ar'), ('as'), ('az'), ('ba'), ('be'), ('bg'), ('bn'), ('br'), ('bs'), ('ca'), ('ch'), ('co'), ('cs'), ('cy'), ('da'),
33 25
			('de'), ('dv'), ('dz'), ('el'), ('en'), ('eo'), ('es'), ('et'), ('eu'), ('fa'), ('fi'), ('fr'), ('fy'), ('ga'), ('gd'), ('gl'), ('gu'), ('he'), ('hi'), ('hr'), ('hu'), ('hy'), ('id'), ('is'),
......
83 75

  
84 76
CREATE TABLE relationships (
85 77
	id1     text REFERENCES organizations(id),
86
	reltype text REFERENCES rel_types(val),
78
	reltype text,
87 79
	id2     text REFERENCES organizations(id),
88 80
    PRIMARY KEY (id1, reltype, id2)
89 81
);
......
109 101
	oa_country       text,
110 102
	oa_url           text,
111 103
	oa_collectedfrom text,
112
	reltype          text  NOT NULL DEFAULT 'suggested' REFERENCES simrel_types(val),
104
	reltype          text  NOT NULL DEFAULT 'suggested',
113 105
	PRIMARY KEY (local_id, oa_id)
114 106
);
115 107

  

Also available in: Unified diff