Dumped on 2010-12-15
| F-Key | Name | Type | Description |
|---|---|---|---|
| id | serial | PRIMARY KEY | |
| task.id | task | integer | |
| builder.id | builder | integer | |
| modtime | timestamp with time zone | NOT NULL DEFAULT now() |
| F-Key | Name | Type | Description |
|---|---|---|---|
| id | serial | PRIMARY KEY | |
| name | character varying(50) | UNIQUE NOT NULL | |
| platform.id | platform | integer | NOT NULL |
| task.id | current | integer | UNIQUE |
| modtime | timestamp with time zone | NOT NULL DEFAULT now() |
| Name | Constraint |
|---|---|
| task_platform | CHECK (check_task(current, platform)) |
Tables referencing this one via Foreign Key Constraints:
| F-Key | Name | Type | Description |
|---|---|---|---|
| id | serial | PRIMARY KEY | |
| uuid | character varying(50) | UNIQUE NOT NULL | |
| submitter | character varying(50) | ||
| job_status.id | status | integer | NOT NULL |
| size | integer | ||
| modtime | timestamp with time zone | NOT NULL DEFAULT now() |
Tables referencing this one via Foreign Key Constraints:
| F-Key | Name | Type | Description |
|---|---|---|---|
| id | serial | PRIMARY KEY | |
| name | character varying(20) | UNIQUE NOT NULL |
Tables referencing this one via Foreign Key Constraints:
| F-Key | Name | Type | Description |
|---|---|---|---|
| id | serial | PRIMARY KEY | |
| name | character varying(10) | UNIQUE#1 NOT NULL | |
| arch | character varying(10) | UNIQUE#1 NOT NULL | |
| active | boolean | NOT NULL DEFAULT false |
Tables referencing this one via Foreign Key Constraints:
| F-Key | Name | Type | Description |
|---|---|---|---|
| id | serial | PRIMARY KEY | |
| job.id | job | integer | UNIQUE#1 NOT NULL |
| platform.id | platform | integer | UNIQUE#1 NOT NULL |
| task_status.id | status | integer | NOT NULL |
| modtime | timestamp with time zone | NOT NULL DEFAULT now() |
Tables referencing this one via Foreign Key Constraints:
| F-Key | Name | Type | Description |
|---|---|---|---|
| id | serial | PRIMARY KEY | |
| name | character varying(20) | UNIQUE NOT NULL |
Tables referencing this one via Foreign Key Constraints:
DECLARE correct BOOLEAN;
BEGIN
SELECT (platform = $2) INTO correct
FROM task
WHERE id = $1;
RETURN correct;
END;
DECLARE
total_count INTEGER := 0;
fail_count INTEGER := 0;
success_count INTEGER := 0;
cancel_count INTEGER := 0;
task_id INTEGER := NEW.id;
job_id INTEGER;
job_status_name VARCHAR(20) := NULL;
BEGIN
SELECT job INTO job_id
FROM task
WHERE id = task_id
LIMIT 1;
IF NOT FOUND THEN
RAISE NOTICE 'Could not find a job for task %', task_id;
RETURN NEW;
END IF;
SELECT COUNT(t.id) INTO total_count
FROM task AS t
WHERE t.job = job_id;
SELECT COUNT(t.id) INTO fail_count
FROM task AS t
JOIN task_status AS s ON t.status = s.id
WHERE t.job = job_id AND s.name = 'fail';
SELECT COUNT(t.id) INTO success_count
FROM task AS t
JOIN task_status AS s ON t.status = s.id
WHERE t.job = job_id AND s.name = 'success';
SELECT COUNT(t.id) INTO cancel_count
FROM task AS t
JOIN task_status AS s ON t.status = s.id
WHERE t.job = job_id AND s.name = 'cancelled';
IF total_count > 0 THEN
IF fail_count > 0 THEN
IF fail_count = total_count THEN
job_status_name := 'fail';
ELSE
job_status_name := 'partial fail';
END IF;
ELSIF success_count > 0 THEN
IF success_count = total_count THEN
job_status_name := 'success';
ELSE
job_status_name := 'partial success';
END IF;
ELSIF cancel_count = total_count THEN
job_status_name := 'cancelled';
END IF;
IF job_status_name IS NOT NULL THEN
UPDATE job SET status =
( SELECT id FROM job_status WHERE name = job_status_name LIMIT 1)
WHERE id = job_id;
END IF;
END IF;
RETURN NEW;
END;
BEGIN NEW.modtime = now(); RETURN NEW; END;
Generated by PostgreSQL Autodoc