Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clinicaltrials
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
david Chavalarias
clinicaltrials
Commits
65e1e7f5
Commit
65e1e7f5
authored
Jan 19, 2017
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
planned changes for comex_shared DB structure
parent
b3da7e32
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
12 deletions
+34
-12
table_specifications.md
doc/table_specifications.md
+34
-12
No files found.
doc/table_specifications.md
View file @
65e1e7f5
...
...
@@ -8,7 +8,10 @@ mysql -uroot -pvery-safe-pass -h $SQL_HOST -P 3306
CREATE DATABASE comex_shared CHARACTER SET utf8 COLLATE utf8_general_ci ;
USE comex_shared ;
CREATE TABLE scholars (
doors_uid char(36) not null unique primary key,
-- local uid necessary for users who still have no doors_uid
luid int(15) not null auto_increment unique primary key,
-- doors uid common to all lab's services
doors_uid char(36) not null unique,
last_modified_date char(24) not null,
email varchar(255) not null unique,
country varchar(60) not null,
...
...
@@ -20,7 +23,6 @@ CREATE TABLE scholars (
position varchar(30), -- eg Director
hon_title varchar(30), -- eg Doctor
interests_text varchar(1200),
community_hashtags varchar(350),
gender char(1),
job_looking_date char(24), -- null if not looking for a job
home_url varchar(120), -- homepage
...
...
@@ -28,9 +30,11 @@ CREATE TABLE scholars (
pic_file mediumblob,
record_status varchar(10),
INDEX
uid_index_sch (doors_
uid),
INDEX
country_index_sch (country
),
INDEX
luid_index_sch (l
uid),
INDEX
duid_index_sch (doors_uid
),
INDEX affs_index_sch (affiliation_id)
INDEX country_index_sch (country),
INDEX status_index_sch (record_status)
) ;
-- affiliations: institutions and labs
...
...
@@ -42,10 +46,8 @@ CREATE TABLE affiliations(
org_city varchar(50),
INDEX affid_index_affs (affid),
PRIMARY KEY (affid),
-- we chose not to put org_type in unique key: should be entailed by other 3
-- TODO doesn't yet prevent entering the same info twice !!
UNIQUE KEY full_affiliation (org, team_lab, org_city)
UNIQUE KEY full_affiliation (org, team_lab, org_city, org_type)
-- NB org_type should be entailed by other 3 in business logic
);
ALTER TABLE scholars ADD FOREIGN KEY (affiliation_id) REFERENCES affiliations(affid) ;
...
...
@@ -61,24 +63,44 @@ CREATE TABLE keywords(
-- relationship scholars <n=n> keywords
CREATE TABLE sch_kw(
uid
char(36
) not null,
uid
int(15
) not null,
kwid int(15) not null,
INDEX uid_index_schkw (uid),
INDEX kwid_index_schkw (kwid),
PRIMARY KEY (uid, kwid),
FOREIGN KEY (uid) REFERENCES scholars(
doors_
uid) ON DELETE CASCADE,
FOREIGN KEY (uid) REFERENCES scholars(
l
uid) ON DELETE CASCADE,
FOREIGN KEY (kwid) REFERENCES keywords(kwid)
);
-- hashtag/workgroup terms
CREATE TABLE hashtags(
htid int(15) not null auto_increment,
htstr char(50) not null unique, -- eg '#dataviz'
INDEX htid_index_hts (htid),
INDEX htstr_index_hts (htstr),
PRIMARY KEY (htid)
);
-- relationship scholars <n=n> hashtags
CREATE TABLE sch_ht(
uid int(15) not null,
htid int(15) not null,
INDEX uid_index_schht (uid),
INDEX htid_index_schht (htid),
PRIMARY KEY (uid, htid),
FOREIGN KEY (uid) REFERENCES scholars(luid) ON DELETE CASCADE,
FOREIGN KEY (htid) REFERENCES hashtags(htid)
);
-- linked identities (various users' ids on soc. media and research networks)
-- TODO use this :)
CREATE TABLE linked_ids(
linkid int(15) not null auto_increment,
uid
char(36
) not null,
uid
int(15
) not null,
ext_id_type char(50) not null, -- eg 'orcid','LinkedIn','Twitter'
ext_id char(50) not null, -- eg "0000-0002-1825-0097"
INDEX uid_index_eids (uid),
PRIMARY KEY (linkid),
FOREIGN KEY (uid) REFERENCES scholars(
doors_
uid) ON DELETE CASCADE
FOREIGN KEY (uid) REFERENCES scholars(
l
uid) ON DELETE CASCADE
);
```
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment