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
e187ac0b
Commit
e187ac0b
authored
Feb 23, 2017
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove unnecessary indexes (when field is key)
parent
259df08b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
28 deletions
+10
-28
table_specifications.md
doc/table_specifications.md
+5
-14
init_comex_shared.sql
setup/dockers/comex2_mysql_server/init_comex_shared.sql
+5
-14
No files found.
doc/table_specifications.md
View file @
e187ac0b
...
@@ -35,12 +35,11 @@ CREATE TABLE scholars (
...
@@ -35,12 +35,11 @@ CREATE TABLE scholars (
home_url varchar(180), -- homepage
home_url varchar(180), -- homepage
pic_url varchar(180), -- remote pic... (full url)
pic_url varchar(180), -- remote pic... (full url)
pic_fname varchar(120), -- ...or locally saved pic (basename)
pic_fname varchar(120), -- ...or locally saved pic (basename)
valid_date date, -- when user will be ignored, if legacy status
record_status varchar(25), -- "active|test|legacy|closed_legacy"
record_status varchar(25), -- "active|test|legacy|closed_legacy"
valid_date date, -- when user will be ignored, if legacy status
old_itemid varchar(30), -- eg imported id from CSS originals
old_itemid varchar(30), -- eg imported id from CSS originals
future_reserved varchar(30), -- eg for an imported id or temp status
future_reserved varchar(30), -- eg for an imported id or temp status
INDEX luid_index_sch (luid),
INDEX duid_index_sch (doors_uid),
INDEX duid_index_sch (doors_uid),
INDEX affs_index_sch (affiliation_id),
INDEX affs_index_sch (affiliation_id),
INDEX country_index_sch (country),
INDEX country_index_sch (country),
...
@@ -55,7 +54,6 @@ CREATE TABLE affiliations(
...
@@ -55,7 +54,6 @@ CREATE TABLE affiliations(
team_lab varchar(120) not null,
team_lab varchar(120) not null,
org_city varchar(50),
org_city varchar(50),
reserved varchar(30),
reserved varchar(30),
INDEX affid_index_affs (affid),
PRIMARY KEY (affid),
PRIMARY KEY (affid),
UNIQUE KEY full_affiliation (org, team_lab, org_city, org_type)
UNIQUE KEY full_affiliation (org, team_lab, org_city, org_type)
-- NB org_type should be entailed by other 3 in business logic
-- NB org_type should be entailed by other 3 in business logic
...
@@ -68,7 +66,6 @@ CREATE TABLE keywords(
...
@@ -68,7 +66,6 @@ CREATE TABLE keywords(
kwid int(15) not null auto_increment,
kwid int(15) not null auto_increment,
kwstr char(70) not null unique, -- eg 'complex networks'
kwstr char(70) not null unique, -- eg 'complex networks'
occs int(15) default 0,
occs int(15) default 0,
INDEX kwid_index_kws (kwid),
INDEX kwstr_index_kws (kwstr),
INDEX kwstr_index_kws (kwstr),
PRIMARY KEY (kwid)
PRIMARY KEY (kwid)
);
);
...
@@ -77,8 +74,6 @@ CREATE TABLE keywords(
...
@@ -77,8 +74,6 @@ CREATE TABLE keywords(
CREATE TABLE sch_kw(
CREATE TABLE sch_kw(
uid int(15) not null,
uid int(15) not null,
kwid int(15) not null,
kwid int(15) not null,
INDEX uid_index_schkw (uid),
INDEX kwid_index_schkw (kwid),
PRIMARY KEY (uid, kwid),
PRIMARY KEY (uid, kwid),
FOREIGN KEY (uid) REFERENCES scholars(luid) ON DELETE CASCADE,
FOREIGN KEY (uid) REFERENCES scholars(luid) ON DELETE CASCADE,
FOREIGN KEY (kwid) REFERENCES keywords(kwid)
FOREIGN KEY (kwid) REFERENCES keywords(kwid)
...
@@ -111,7 +106,6 @@ FOR EACH ROW UPDATE keywords JOIN sch_kw ON keywords.kwid = sch_kw.kwid SET occs
...
@@ -111,7 +106,6 @@ FOR EACH ROW UPDATE keywords JOIN sch_kw ON keywords.kwid = sch_kw.kwid SET occs
CREATE TABLE hashtags(
CREATE TABLE hashtags(
htid int(15) not null auto_increment,
htid int(15) not null auto_increment,
htstr char(50) not null unique, -- eg '#dataviz'
htstr char(50) not null unique, -- eg '#dataviz'
INDEX htid_index_hts (htid),
INDEX htstr_index_hts (htstr),
INDEX htstr_index_hts (htstr),
PRIMARY KEY (htid)
PRIMARY KEY (htid)
);
);
...
@@ -120,8 +114,6 @@ CREATE TABLE hashtags(
...
@@ -120,8 +114,6 @@ CREATE TABLE hashtags(
CREATE TABLE sch_ht(
CREATE TABLE sch_ht(
uid int(15) not null,
uid int(15) not null,
htid int(15) not null,
htid int(15) not null,
INDEX uid_index_schht (uid),
INDEX htid_index_schht (htid),
PRIMARY KEY (uid, htid),
PRIMARY KEY (uid, htid),
FOREIGN KEY (uid) REFERENCES scholars(luid) ON DELETE CASCADE,
FOREIGN KEY (uid) REFERENCES scholars(luid) ON DELETE CASCADE,
FOREIGN KEY (htid) REFERENCES hashtags(htid)
FOREIGN KEY (htid) REFERENCES hashtags(htid)
...
@@ -134,7 +126,6 @@ CREATE TABLE linked_ids(
...
@@ -134,7 +126,6 @@ CREATE TABLE linked_ids(
uid int(15) not null,
uid int(15) not null,
ext_id_type char(50) not null, -- eg 'orcid','LinkedIn','Twitter'
ext_id_type char(50) not null, -- eg 'orcid','LinkedIn','Twitter'
ext_id char(50) not null, -- eg "0000-0002-1825-0097"
ext_id char(50) not null, -- eg "0000-0002-1825-0097"
INDEX uid_index_eids (uid),
PRIMARY KEY (linkid),
PRIMARY KEY (linkid),
FOREIGN KEY (uid) REFERENCES scholars(luid) ON DELETE CASCADE
FOREIGN KEY (uid) REFERENCES scholars(luid) ON DELETE CASCADE
);
);
...
@@ -142,17 +133,17 @@ CREATE TABLE linked_ids(
...
@@ -142,17 +133,17 @@ CREATE TABLE linked_ids(
-- separate buffer table for incoming doors users without a profile in scholars
-- separate buffer table for incoming doors users without a profile in scholars
-- (allows us to avoid reasking them for their doors info like email)
-- (allows us to avoid reasking them for their doors info like email)
CREATE TABLE doors_temp_user (
CREATE TABLE doors_temp_user (
doors_uid char(36) not null unique
primary key
,
doors_uid char(36) not null unique,
email varchar(255) not null unique,
email varchar(255) not null unique,
INDEX duid_index_dtempu
(doors_uid)
PRIMARY KEY
(doors_uid)
) ;
) ;
-- separate buffer table for rettoks
-- separate buffer table for rettoks
-- (return tokens associated to a legacy user)
-- (return tokens associated to a legacy user)
CREATE TABLE legacy_temp_rettoks (
CREATE TABLE legacy_temp_rettoks (
luid int(15) not null unique
primary key
,
luid int(15) not null unique,
rettok char(36) not null unique,
rettok char(36) not null unique,
INDEX luid_index_ltempt
(luid),
PRIMARY KEY
(luid),
INDEX rettok_index_ltempt (rettok)
INDEX rettok_index_ltempt (rettok)
) ;
) ;
```
```
setup/dockers/comex2_mysql_server/init_comex_shared.sql
View file @
e187ac0b
...
@@ -28,12 +28,11 @@ CREATE TABLE scholars (
...
@@ -28,12 +28,11 @@ CREATE TABLE scholars (
home_url
varchar
(
180
),
-- homepage
home_url
varchar
(
180
),
-- homepage
pic_url
varchar
(
180
),
-- remote pic... (full url)
pic_url
varchar
(
180
),
-- remote pic... (full url)
pic_fname
varchar
(
120
),
-- ...or locally saved pic (basename)
pic_fname
varchar
(
120
),
-- ...or locally saved pic (basename)
valid_date
date
,
-- when user will be ignored, if legacy status
record_status
varchar
(
25
),
-- "active|test|legacy|closed_legacy"
record_status
varchar
(
25
),
-- "active|test|legacy|closed_legacy"
valid_date
date
,
-- when user will be ignored, if legacy status
old_itemid
varchar
(
30
),
-- eg imported id from CSS originals
old_itemid
varchar
(
30
),
-- eg imported id from CSS originals
future_reserved
varchar
(
30
),
-- eg for an imported id or temp status
future_reserved
varchar
(
30
),
-- eg for an imported id or temp status
INDEX
luid_index_sch
(
luid
),
INDEX
duid_index_sch
(
doors_uid
),
INDEX
duid_index_sch
(
doors_uid
),
INDEX
affs_index_sch
(
affiliation_id
),
INDEX
affs_index_sch
(
affiliation_id
),
INDEX
country_index_sch
(
country
),
INDEX
country_index_sch
(
country
),
...
@@ -48,7 +47,6 @@ CREATE TABLE affiliations(
...
@@ -48,7 +47,6 @@ CREATE TABLE affiliations(
team_lab
varchar
(
120
)
not
null
,
team_lab
varchar
(
120
)
not
null
,
org_city
varchar
(
50
),
org_city
varchar
(
50
),
reserved
varchar
(
30
),
reserved
varchar
(
30
),
INDEX
affid_index_affs
(
affid
),
PRIMARY
KEY
(
affid
),
PRIMARY
KEY
(
affid
),
UNIQUE
KEY
full_affiliation
(
org
,
team_lab
,
org_city
,
org_type
)
UNIQUE
KEY
full_affiliation
(
org
,
team_lab
,
org_city
,
org_type
)
-- NB org_type should be entailed by other 3 in business logic
-- NB org_type should be entailed by other 3 in business logic
...
@@ -61,7 +59,6 @@ CREATE TABLE keywords(
...
@@ -61,7 +59,6 @@ CREATE TABLE keywords(
kwid
int
(
15
)
not
null
auto_increment
,
kwid
int
(
15
)
not
null
auto_increment
,
kwstr
char
(
70
)
not
null
unique
,
-- eg 'complex networks'
kwstr
char
(
70
)
not
null
unique
,
-- eg 'complex networks'
occs
int
(
15
)
default
0
,
occs
int
(
15
)
default
0
,
INDEX
kwid_index_kws
(
kwid
),
INDEX
kwstr_index_kws
(
kwstr
),
INDEX
kwstr_index_kws
(
kwstr
),
PRIMARY
KEY
(
kwid
)
PRIMARY
KEY
(
kwid
)
);
);
...
@@ -70,8 +67,6 @@ CREATE TABLE keywords(
...
@@ -70,8 +67,6 @@ CREATE TABLE keywords(
CREATE
TABLE
sch_kw
(
CREATE
TABLE
sch_kw
(
uid
int
(
15
)
not
null
,
uid
int
(
15
)
not
null
,
kwid
int
(
15
)
not
null
,
kwid
int
(
15
)
not
null
,
INDEX
uid_index_schkw
(
uid
),
INDEX
kwid_index_schkw
(
kwid
),
PRIMARY
KEY
(
uid
,
kwid
),
PRIMARY
KEY
(
uid
,
kwid
),
FOREIGN
KEY
(
uid
)
REFERENCES
scholars
(
luid
)
ON
DELETE
CASCADE
,
FOREIGN
KEY
(
uid
)
REFERENCES
scholars
(
luid
)
ON
DELETE
CASCADE
,
FOREIGN
KEY
(
kwid
)
REFERENCES
keywords
(
kwid
)
FOREIGN
KEY
(
kwid
)
REFERENCES
keywords
(
kwid
)
...
@@ -104,7 +99,6 @@ FOR EACH ROW UPDATE keywords JOIN sch_kw ON keywords.kwid = sch_kw.kwid SET occs
...
@@ -104,7 +99,6 @@ FOR EACH ROW UPDATE keywords JOIN sch_kw ON keywords.kwid = sch_kw.kwid SET occs
CREATE
TABLE
hashtags
(
CREATE
TABLE
hashtags
(
htid
int
(
15
)
not
null
auto_increment
,
htid
int
(
15
)
not
null
auto_increment
,
htstr
char
(
50
)
not
null
unique
,
-- eg '#dataviz'
htstr
char
(
50
)
not
null
unique
,
-- eg '#dataviz'
INDEX
htid_index_hts
(
htid
),
INDEX
htstr_index_hts
(
htstr
),
INDEX
htstr_index_hts
(
htstr
),
PRIMARY
KEY
(
htid
)
PRIMARY
KEY
(
htid
)
);
);
...
@@ -113,8 +107,6 @@ CREATE TABLE hashtags(
...
@@ -113,8 +107,6 @@ CREATE TABLE hashtags(
CREATE
TABLE
sch_ht
(
CREATE
TABLE
sch_ht
(
uid
int
(
15
)
not
null
,
uid
int
(
15
)
not
null
,
htid
int
(
15
)
not
null
,
htid
int
(
15
)
not
null
,
INDEX
uid_index_schht
(
uid
),
INDEX
htid_index_schht
(
htid
),
PRIMARY
KEY
(
uid
,
htid
),
PRIMARY
KEY
(
uid
,
htid
),
FOREIGN
KEY
(
uid
)
REFERENCES
scholars
(
luid
)
ON
DELETE
CASCADE
,
FOREIGN
KEY
(
uid
)
REFERENCES
scholars
(
luid
)
ON
DELETE
CASCADE
,
FOREIGN
KEY
(
htid
)
REFERENCES
hashtags
(
htid
)
FOREIGN
KEY
(
htid
)
REFERENCES
hashtags
(
htid
)
...
@@ -127,7 +119,6 @@ CREATE TABLE linked_ids(
...
@@ -127,7 +119,6 @@ CREATE TABLE linked_ids(
uid
int
(
15
)
not
null
,
uid
int
(
15
)
not
null
,
ext_id_type
char
(
50
)
not
null
,
-- eg 'orcid','LinkedIn','Twitter'
ext_id_type
char
(
50
)
not
null
,
-- eg 'orcid','LinkedIn','Twitter'
ext_id
char
(
50
)
not
null
,
-- eg "0000-0002-1825-0097"
ext_id
char
(
50
)
not
null
,
-- eg "0000-0002-1825-0097"
INDEX
uid_index_eids
(
uid
),
PRIMARY
KEY
(
linkid
),
PRIMARY
KEY
(
linkid
),
FOREIGN
KEY
(
uid
)
REFERENCES
scholars
(
luid
)
ON
DELETE
CASCADE
FOREIGN
KEY
(
uid
)
REFERENCES
scholars
(
luid
)
ON
DELETE
CASCADE
);
);
...
@@ -135,16 +126,16 @@ CREATE TABLE linked_ids(
...
@@ -135,16 +126,16 @@ CREATE TABLE linked_ids(
-- separate buffer table for incoming doors users without a profile in scholars
-- separate buffer table for incoming doors users without a profile in scholars
-- (allows us to avoid reasking them for their doors info like email)
-- (allows us to avoid reasking them for their doors info like email)
CREATE
TABLE
doors_temp_user
(
CREATE
TABLE
doors_temp_user
(
doors_uid
char
(
36
)
not
null
unique
primary
key
,
doors_uid
char
(
36
)
not
null
unique
,
email
varchar
(
255
)
not
null
unique
,
email
varchar
(
255
)
not
null
unique
,
INDEX
duid_index_dtempu
(
doors_uid
)
PRIMARY
KEY
(
doors_uid
)
)
;
)
;
-- separate buffer table for rettoks
-- separate buffer table for rettoks
-- (return tokens associated to a legacy user)
-- (return tokens associated to a legacy user)
CREATE
TABLE
legacy_temp_rettoks
(
CREATE
TABLE
legacy_temp_rettoks
(
luid
int
(
15
)
not
null
unique
primary
key
,
luid
int
(
15
)
not
null
unique
,
rettok
char
(
36
)
not
null
unique
,
rettok
char
(
36
)
not
null
unique
,
INDEX
luid_index_ltempt
(
luid
),
PRIMARY
KEY
(
luid
),
INDEX
rettok_index_ltempt
(
rettok
)
INDEX
rettok_index_ltempt
(
rettok
)
)
;
)
;
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