Commit 29290692 authored by Leo Gordon's avatar Leo Gordon
Browse files

added analysis_id column to job_message table - it is much more convenient that way

parent 5d6af542
......@@ -32,9 +32,9 @@ sub register_message {
# (the timestamp 'moment' column will be set automatically)
my $sql = qq{
REPLACE INTO job_message (analysis_job_id, worker_id, retry_count, status, msg, is_error)
SELECT analysis_job_id, worker_id, retry_count, status, ?, ?
FROM analysis_job WHERE analysis_job_id=?
REPLACE INTO job_message (analysis_job_id, worker_id, analysis_id, retry_count, status, msg, is_error)
SELECT analysis_job_id, worker_id, analysis_id, retry_count, status, ?, ?
FROM analysis_job WHERE analysis_job_id=?
};
my $sth = $self->prepare( $sql );
......
## It is indeed redundant (can be found by joining), but proved to be very convenient to have:
ALTER TABLE job_message ADD COLUMN analysis_id int(10) DEFAULT 0 NOT NULL AFTER worker_id;
UPDATE job_message m, analysis_job j SET m.analysis_id=j.analysis_id WHERE j.analysis_job_id=m.analysis_job_id;
......@@ -157,6 +157,7 @@ CREATE TABLE analysis_job (
-- semantics:
-- analysis_job_id - the id of the job that threw the message
-- worker_id - the worker in charge of the job at the moment
-- analysis_id - analysis_id of both the job and the worker (it is indeed redundant, but very convenient)
-- moment - when the message was thrown
-- retry_count - of the job when the message was thrown
-- status - of the job when the message was thrown
......@@ -166,6 +167,7 @@ CREATE TABLE analysis_job (
CREATE TABLE job_message (
analysis_job_id int(10) NOT NULL,
worker_id int(10) NOT NULL,
analysis_id int(10) NOT NULL,
moment timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
retry_count int(10) DEFAULT 0 NOT NULL,
status enum('UNKNOWN', 'COMPILATION', 'GET_INPUT', 'RUN', 'WRITE_OUTPUT') DEFAULT 'UNKNOWN',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment