Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ensembl-gh-mirror
ensembl-hive
Commits
e78646b2
Commit
e78646b2
authored
Jan 21, 2011
by
Leo Gordon
Browse files
foreign keys have moved out into a separate file for flexibility
parent
198ed272
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
28 deletions
+27
-28
modules/Bio/EnsEMBL/Hive/PipeConfig/HiveGeneric_conf.pm
modules/Bio/EnsEMBL/Hive/PipeConfig/HiveGeneric_conf.pm
+2
-1
sql/foreign_keys.sql
sql/foreign_keys.sql
+23
-0
sql/tables.sql
sql/tables.sql
+2
-27
No files found.
modules/Bio/EnsEMBL/Hive/PipeConfig/HiveGeneric_conf.pm
View file @
e78646b2
...
...
@@ -90,8 +90,9 @@ sub pipeline_create_commands {
return
[
'
mysql
'
.
$self
->
dbconn_2_mysql
('
pipeline_db
',
0
)
.
"
-e 'CREATE DATABASE
"
.
$self
->
o
('
pipeline_db
',
'
-dbname
')
.
"
'
",
# standard eHive tables and procedures:
# standard eHive tables
, foreign_keys
and procedures:
'
mysql
'
.
$self
->
dbconn_2_mysql
('
pipeline_db
',
1
)
.
'
<
'
.
$self
->
o
('
ensembl_cvs_root_dir
')
.
'
/ensembl-hive/sql/tables.sql
',
'
mysql
'
.
$self
->
dbconn_2_mysql
('
pipeline_db
',
1
)
.
'
<
'
.
$self
->
o
('
ensembl_cvs_root_dir
')
.
'
/ensembl-hive/sql/foreign_keys.sql
',
'
mysql
'
.
$self
->
dbconn_2_mysql
('
pipeline_db
',
1
)
.
'
<
'
.
$self
->
o
('
ensembl_cvs_root_dir
')
.
'
/ensembl-hive/sql/procedures.sql
',
];
}
...
...
sql/foreign_keys.sql
0 → 100644
View file @
e78646b2
#
introducing
the
FOREIGN
KEY
constraints
as
a
separate
file
(
so
that
they
could
be
optionally
switched
on
or
off
):
ALTER
TABLE
analysis_description
ADD
FOREIGN
KEY
(
analysis_id
)
REFERENCES
analysis
(
analysis_id
);
ALTER
TABLE
hive
ADD
FOREIGN
KEY
(
analysis_id
)
REFERENCES
analysis
(
analysis_id
);
ALTER
TABLE
dataflow_rule
ADD
FOREIGN
KEY
(
from_analysis_id
)
REFERENCES
analysis
(
analysis_id
);
ALTER
TABLE
analysis_ctrl_rule
ADD
FOREIGN
KEY
(
ctrled_analysis_id
)
REFERENCES
analysis
(
analysis_id
);
ALTER
TABLE
analysis_job
ADD
FOREIGN
KEY
(
analysis_id
)
REFERENCES
analysis
(
analysis_id
);
ALTER
TABLE
job_message
ADD
FOREIGN
KEY
(
analysis_id
)
REFERENCES
analysis
(
analysis_id
);
ALTER
TABLE
analysis_stats
ADD
FOREIGN
KEY
(
analysis_id
)
REFERENCES
analysis
(
analysis_id
);
ALTER
TABLE
analysis_stats_monitor
ADD
FOREIGN
KEY
(
analysis_id
)
REFERENCES
analysis
(
analysis_id
);
ALTER
TABLE
analysis_job
ADD
FOREIGN
KEY
(
worker_id
)
REFERENCES
hive
(
worker_id
);
ALTER
TABLE
job_message
ADD
FOREIGN
KEY
(
worker_id
)
REFERENCES
hive
(
worker_id
);
ALTER
TABLE
analysis_job_file
ADD
FOREIGN
KEY
(
worker_id
)
REFERENCES
hive
(
worker_id
);
ALTER
TABLE
analysis_job
ADD
FOREIGN
KEY
(
prev_analysis_job_id
)
REFERENCES
analysis_job
(
analysis_job_id
);
ALTER
TABLE
job_message
ADD
FOREIGN
KEY
(
analysis_job_id
)
REFERENCES
analysis_job
(
analysis_job_id
);
ALTER
TABLE
analysis_job_file
ADD
FOREIGN
KEY
(
analysis_job_id
)
REFERENCES
analysis_job
(
analysis_job_id
);
##
The
following
are
not
unique
keys
in
the
original
table
,
so
cannot
be
used
as
foreign
keys
.
#
ALTER
TABLE
analysis_stats
ADD
FOREIGN
KEY
(
rc_id
)
REFERENCES
resource_description
(
rc_id
);
#
ALTER
TABLE
analysis_stats_monitor
ADD
FOREIGN
KEY
(
rc_id
)
REFERENCES
resource_description
(
rc_id
);
sql/tables.sql
View file @
e78646b2
...
...
@@ -82,8 +82,6 @@ CREATE TABLE IF NOT EXISTS analysis_description (
displayable
BOOLEAN
NOT
NULL
DEFAULT
1
,
web_data
TEXT
,
FOREIGN
KEY
(
analysis_id
)
REFERENCES
analysis
(
analysis_id
),
UNIQUE
KEY
analysis_idx
(
analysis_id
)
)
COLLATE
=
latin1_swedish_ci
ENGINE
=
InnoDB
;
...
...
@@ -119,8 +117,6 @@ CREATE TABLE hive (
died
datetime
DEFAULT
NULL
,
cause_of_death
enum
(
''
,
'NO_WORK'
,
'JOB_LIMIT'
,
'HIVE_OVERLOAD'
,
'LIFESPAN'
,
'CONTAMINATED'
,
'KILLED_BY_USER'
,
'MEMLIMIT'
,
'RUNLIMIT'
,
'FATALITY'
)
DEFAULT
''
NOT
NULL
,
FOREIGN
KEY
(
analysis_id
)
REFERENCES
analysis
(
analysis_id
),
PRIMARY
KEY
(
worker_id
),
INDEX
analysis_status
(
analysis_id
,
status
)
...
...
@@ -161,8 +157,6 @@ CREATE TABLE dataflow_rule (
branch_code
int
(
10
)
default
1
NOT
NULL
,
input_id_template
TEXT
DEFAULT
NULL
,
FOREIGN
KEY
(
from_analysis_id
)
REFERENCES
analysis
(
analysis_id
),
PRIMARY
KEY
(
dataflow_rule_id
),
UNIQUE
KEY
(
from_analysis_id
,
to_analysis_url
,
branch_code
,
input_id_template
(
512
))
...
...
@@ -192,8 +186,6 @@ CREATE TABLE analysis_ctrl_rule (
condition_analysis_url
varchar
(
255
)
default
''
NOT
NULL
,
ctrled_analysis_id
int
(
10
)
unsigned
NOT
NULL
,
FOREIGN
KEY
(
ctrled_analysis_id
)
REFERENCES
analysis
(
analysis_id
),
UNIQUE
(
condition_analysis_url
,
ctrled_analysis_id
)
)
COLLATE
=
latin1_swedish_ci
ENGINE
=
InnoDB
;
...
...
@@ -239,10 +231,6 @@ CREATE TABLE analysis_job (
semaphore_count
int
(
10
)
NOT
NULL
default
0
,
semaphored_job_id
int
(
10
)
DEFAULT
NULL
,
FOREIGN
KEY
(
analysis_id
)
REFERENCES
analysis
(
analysis_id
),
FOREIGN
KEY
(
worker_id
)
REFERENCES
hive
(
worker_id
),
FOREIGN
KEY
(
prev_analysis_job_id
)
REFERENCES
analysis_job
(
analysis_job_id
),
PRIMARY
KEY
(
analysis_job_id
),
UNIQUE
KEY
input_id_analysis
(
input_id
,
analysis_id
),
INDEX
analysis_status_sema_retry
(
analysis_id
,
status
,
semaphore_count
,
retry_count
),
...
...
@@ -279,10 +267,6 @@ CREATE TABLE job_message (
msg
text
,
is_error
boolean
,
FOREIGN
KEY
(
analysis_id
)
REFERENCES
analysis
(
analysis_id
),
FOREIGN
KEY
(
analysis_job_id
)
REFERENCES
analysis_job
(
analysis_job_id
),
FOREIGN
KEY
(
worker_id
)
REFERENCES
hive
(
worker_id
),
PRIMARY
KEY
(
analysis_job_id
,
worker_id
,
moment
),
INDEX
worker_id
(
worker_id
),
INDEX
analysis_job_id
(
analysis_job_id
)
...
...
@@ -314,9 +298,6 @@ CREATE TABLE analysis_job_file (
type
varchar
(
16
)
NOT
NULL
default
''
,
path
varchar
(
255
)
NOT
NULL
,
FOREIGN
KEY
(
worker_id
)
REFERENCES
hive
(
worker_id
),
FOREIGN
KEY
(
analysis_job_id
)
REFERENCES
analysis_job
(
analysis_job_id
),
UNIQUE
KEY
job_hive_type
(
analysis_job_id
,
worker_id
,
type
),
INDEX
worker_id
(
worker_id
)
...
...
@@ -397,10 +378,7 @@ CREATE TABLE analysis_stats (
rc_id
int
(
10
)
unsigned
default
0
NOT
NULL
,
can_be_empty
TINYINT
UNSIGNED
DEFAULT
0
NOT
NULL
,
UNIQUE
KEY
(
analysis_id
),
FOREIGN
KEY
(
analysis_id
)
REFERENCES
analysis
(
analysis_id
)
#
,
FOREIGN
KEY
(
rc_id
)
REFERENCES
resource_description
(
rc_id
),
UNIQUE
KEY
(
analysis_id
)
)
COLLATE
=
latin1_swedish_ci
ENGINE
=
InnoDB
;
...
...
@@ -430,10 +408,7 @@ CREATE TABLE analysis_stats_monitor (
last_update
datetime
NOT
NULL
,
sync_lock
int
(
10
)
default
0
NOT
NULL
,
rc_id
int
(
10
)
unsigned
default
0
NOT
NULL
,
can_be_empty
TINYINT
UNSIGNED
DEFAULT
0
NOT
NULL
,
FOREIGN
KEY
(
analysis_id
)
REFERENCES
analysis
(
analysis_id
)
#
,
FOREIGN
KEY
(
rc_id
)
REFERENCES
resource_description
(
rc_id
)
can_be_empty
TINYINT
UNSIGNED
DEFAULT
0
NOT
NULL
)
COLLATE
=
latin1_swedish_ci
ENGINE
=
InnoDB
;
...
...
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