2023-03-06 18:21:56 +00:00
|
|
|
BEGIN;
|
|
|
|
|
2023-02-27 19:51:53 +00:00
|
|
|
-- builds
|
|
|
|
CREATE TABLE builds (
|
|
|
|
id INTEGER PRIMARY KEY,
|
|
|
|
url VARCHAR(50) NOT NULL,
|
2023-03-07 15:02:14 +00:00
|
|
|
created_at DOUBLE PRECISION NOT NULL,
|
|
|
|
finished_at DOUBLE PRECISION
|
2023-02-27 19:51:53 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
CREATE INDEX IF NOT EXISTS builds_created_at
|
|
|
|
ON builds(created_at);
|
|
|
|
|
|
|
|
CREATE INDEX IF NOT EXISTS builds_finished_at
|
|
|
|
ON builds(finished_at);
|
|
|
|
|
|
|
|
|
2023-03-13 19:30:40 +00:00
|
|
|
-- build_tasks_enum
|
2023-02-28 17:28:48 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS build_task_status_enum(
|
2023-02-27 19:51:53 +00:00
|
|
|
id INTEGER PRIMARY KEY,
|
|
|
|
value VARCHAR(15)
|
|
|
|
);
|
|
|
|
|
2023-02-28 17:28:48 +00:00
|
|
|
INSERT INTO build_task_status_enum (id, value)
|
2023-02-27 19:51:53 +00:00
|
|
|
VALUES
|
|
|
|
(0, 'idle'),
|
|
|
|
(1, 'started'),
|
|
|
|
(2, 'completed'),
|
|
|
|
(3, 'failed'),
|
|
|
|
(4, 'excluded');
|
|
|
|
|
|
|
|
|
|
|
|
-- arch_enum
|
|
|
|
CREATE TABLE arch_enum(
|
|
|
|
id INTEGER PRIMARY KEY,
|
|
|
|
value VARCHAR(15)
|
|
|
|
);
|
|
|
|
|
|
|
|
INSERT INTO arch_enum(id, value)
|
|
|
|
VALUES
|
|
|
|
(0, 'i686'),
|
|
|
|
(1, 'x86_64'),
|
|
|
|
(2, 'aarch64'),
|
|
|
|
(3, 'ppc64le'),
|
|
|
|
(4, 's390x');
|
|
|
|
|
|
|
|
|
2023-03-06 18:21:56 +00:00
|
|
|
-- web_node_stats_enum
|
|
|
|
CREATE TABLE web_node_stats_enum (
|
|
|
|
id INTEGER PRIMARY KEY,
|
|
|
|
value VARCHAR(50)
|
|
|
|
);
|
|
|
|
|
|
|
|
INSERT INTO web_node_stats_enum (id, value)
|
2023-03-13 19:30:40 +00:00
|
|
|
VALUES
|
2023-03-06 18:21:56 +00:00
|
|
|
(0, 'build_done'),
|
|
|
|
(1, 'logs_processing'),
|
|
|
|
(2, 'packages_processing');
|
|
|
|
|
|
|
|
|
|
|
|
-- build_node_stats_enum
|
|
|
|
CREATE TABLE build_node_stats_enum(
|
|
|
|
id INTEGER PRIMARY KEY,
|
|
|
|
value VARCHAR(50)
|
|
|
|
);
|
|
|
|
|
|
|
|
INSERT INTO build_node_stats_enum (id, value)
|
|
|
|
VALUES
|
|
|
|
(0, 'upload'),
|
|
|
|
(1, 'build_all'),
|
|
|
|
(2, 'build_srpm'),
|
|
|
|
(3, 'git_checkout'),
|
|
|
|
(4, 'build_binaries'),
|
|
|
|
(5, 'build_packages'),
|
|
|
|
(6, 'build_node_task'),
|
|
|
|
(7, 'cas_notarize_artifacts'),
|
|
|
|
(8, 'cas_source_authenticate');
|
|
|
|
|
|
|
|
|
2023-02-27 19:51:53 +00:00
|
|
|
-- build_tasks
|
|
|
|
CREATE TABLE build_tasks (
|
|
|
|
id INTEGER PRIMARY KEY,
|
2023-03-01 13:13:14 +00:00
|
|
|
name VARCHAR(50) NOT NULL,
|
2023-02-27 19:51:53 +00:00
|
|
|
build_id INTEGER REFERENCES builds(id) ON DELETE CASCADE,
|
|
|
|
arch_id INTEGER REFERENCES arch_enum(id) ON DELETE SET NULL,
|
2023-02-28 17:28:48 +00:00
|
|
|
status_id INTEGER REFERENCES build_task_status_enum(id) ON DELETE SET NULL,
|
2023-03-07 15:02:14 +00:00
|
|
|
started_at DOUBLE PRECISION,
|
|
|
|
finished_at DOUBLE PRECISION
|
2023-02-27 19:51:53 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE INDEX build_tasks_build_id
|
|
|
|
ON build_tasks(build_id);
|
|
|
|
|
|
|
|
CREATE INDEX build_tasks_started_at
|
|
|
|
ON build_tasks(started_at);
|
|
|
|
|
|
|
|
CREATE INDEX build_tasks_finished_at
|
|
|
|
ON build_tasks(finished_at);
|
|
|
|
|
|
|
|
|
2023-03-06 18:21:56 +00:00
|
|
|
-- web_node_stats
|
|
|
|
CREATE TABLE web_node_stats (
|
|
|
|
build_task_id INTEGER REFERENCES build_tasks(id) ON DELETE CASCADE,
|
|
|
|
stat_name_id INTEGER REFERENCES web_node_stats_enum(id) ON DELETE SET NULL,
|
2023-03-07 15:02:14 +00:00
|
|
|
start_ts DOUBLE PRECISION,
|
|
|
|
end_ts DOUBLE PRECISION
|
2023-03-06 18:21:56 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE INDEX web_node_stats_build_task_id
|
|
|
|
ON web_node_stats(build_task_id);
|
|
|
|
|
|
|
|
CREATE INDEX web_node_stats_start_ts
|
|
|
|
ON web_node_stats(start_ts);
|
|
|
|
|
|
|
|
CREATE INDEX web_node_stats_end_ts
|
|
|
|
ON web_node_stats(end_ts);
|
|
|
|
|
|
|
|
|
|
|
|
-- build_node_stats
|
|
|
|
CREATE TABLE build_node_stats (
|
|
|
|
build_task_id INTEGER REFERENCES build_tasks(id) ON DELETE CASCADE,
|
|
|
|
stat_name_id INTEGER REFERENCES build_node_stats_enum(id) ON DELETE SET NULL,
|
2023-03-07 15:02:14 +00:00
|
|
|
start_ts DOUBLE PRECISION,
|
|
|
|
end_ts DOUBLE PRECISION
|
2023-03-06 18:21:56 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE INDEX build_node_stats_build_task_id
|
|
|
|
ON build_node_stats(build_task_id);
|
|
|
|
|
|
|
|
CREATE INDEX build_node_stats_build_start_ts
|
|
|
|
ON build_node_stats(start_ts);
|
|
|
|
|
|
|
|
CREATE INDEX build_node_stats_build_end_ts
|
|
|
|
ON build_node_stats(end_ts);
|
|
|
|
|
|
|
|
|
2023-02-27 19:51:53 +00:00
|
|
|
-- sign_tasks
|
|
|
|
CREATE TABLE sign_tasks (
|
|
|
|
id INTEGER PRIMARY KEY,
|
|
|
|
build_id INTEGER REFERENCES builds(id) ON DELETE CASCADE,
|
|
|
|
buildtask_id INTEGER REFERENCES build_tasks(id) ON DELETE CASCADE,
|
2023-03-07 15:02:14 +00:00
|
|
|
started_at DOUBLE PRECISION,
|
|
|
|
finished_at DOUBLE PRECISION
|
2023-02-27 19:51:53 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE INDEX sign_tasks_build_id
|
|
|
|
ON sign_tasks(build_id);
|
|
|
|
|
|
|
|
CREATE INDEX sign_tasks_buildtask_id
|
|
|
|
ON sign_tasks(buildtask_id);
|
|
|
|
|
|
|
|
CREATE INDEX sing_tasks_started_at
|
|
|
|
ON sign_tasks(started_at);
|
|
|
|
|
|
|
|
CREATE INDEX sign_tasks_finished_at
|
|
|
|
ON sign_tasks(finished_at);
|
2023-03-06 18:21:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
-- schema_version
|
|
|
|
CREATE TABLE schema_version (
|
|
|
|
version INTEGER
|
|
|
|
);
|
|
|
|
INSERT INTO schema_version (version)
|
|
|
|
VALUES (1);
|
|
|
|
|
|
|
|
COMMIT;
|