ALBS-1043 #2
@ -16,7 +16,7 @@ CREATE INDEX IF NOT EXISTS builds_finished_at
|
||||
ON builds(finished_at);
|
||||
|
||||
|
||||
-- build_taks_enum
|
||||
-- build_tasks_enum
|
||||
CREATE TABLE IF NOT EXISTS build_task_status_enum(
|
||||
id INTEGER PRIMARY KEY,
|
||||
value VARCHAR(15)
|
||||
@ -53,7 +53,7 @@ CREATE TABLE web_node_stats_enum (
|
||||
);
|
||||
|
||||
INSERT INTO web_node_stats_enum (id, value)
|
||||
VALUEs
|
||||
VALUES
|
||||
(0, 'build_done'),
|
||||
(1, 'logs_processing'),
|
||||
(2, 'packages_processing');
|
||||
|
78
build_analytics/migrations/3.sql
Normal file
78
build_analytics/migrations/3.sql
Normal file
@ -0,0 +1,78 @@
|
||||
BEGIN;
|
||||
|
||||
-- test_task_status_enum
|
||||
CREATE TABLE test_task_status_enum(
|
||||
id INTEGER PRIMARY KEY,
|
||||
value VARCHAR(15)
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
INSERT INTO test_task_status_enum (id, value)
|
||||
VALUES
|
||||
(0, 'created'),
|
||||
(1, 'started'),
|
||||
(2, 'completed'),
|
||||
(3, 'failed');
|
||||
|
||||
|
||||
-- test_task
|
||||
CREATE TABLE test_task (
|
||||
id INTEGER PRIMARY KEY,
|
||||
build_task_id INTEGER REFERENCES build_tasks(id) ON DELETE CASCADE,
|
||||
revision INTEGER,
|
||||
status_id INTEGER REFERENCES test_task_status_enum(id) ON DELETE SET NULL,
|
||||
package_fullname VARCHAR(100)
|
||||
);
|
||||
|
||||
CREATE INDEX test_task_build_task_id
|
||||
ON test_task(build_task_id);
|
||||
|
||||
CREATE INDEX test_task_build_status_id
|
||||
ON test_task(status_id);
|
||||
|
||||
CREATE INDEX test_task_package_fullname
|
||||
ON test_task(package_fullname);
|
||||
|
||||
|
||||
-- test_step_enum
|
||||
CREATE TABLE test_step_enum (
|
||||
id INTEGER PRIMARY KEY,
|
||||
value VARCHAR(50)
|
||||
);
|
||||
|
||||
INSERT INTO test_step_enum (id, value)
|
||||
VALUES
|
||||
(1, 'install_package'),
|
||||
(2, 'stop_environment'),
|
||||
(3, 'initial_provision'),
|
||||
(4, 'start_environment'),
|
||||
(5, 'uninstall_package'),
|
||||
(6, 'initialize_terraform'),
|
||||
(7, 'package_integrity_tests');
|
||||
|
||||
|
||||
|
||||
-- test_step
|
||||
CREATE TABLE test_step_stats(
|
||||
test_task_id INTEGER,
|
||||
stat_name_id INTEGER REFERENCES test_step_enum(id) ON DELETE SET NULL,
|
||||
start_ts DOUBLE PRECISION,
|
||||
end_ts DOUBLE PRECISION
|
||||
);
|
||||
|
||||
ALTER TABLE test_step_stats
|
||||
ADD CONSTRAINT test_step_stats_unique UNIQUE (test_task_id, stat_name_id);
|
||||
|
||||
CREATE INDEX test_step_stats_start_ts
|
||||
ON test_step_stats(start_ts);
|
||||
|
||||
CREATE INDEX test_step_stats_end_ts
|
||||
ON test_step_stats(end_ts);
|
||||
|
||||
|
||||
UPDATE schema_version
|
||||
SET version = 3;
|
||||
|
||||
COMMIT;
|
Loading…
Reference in New Issue
Block a user