diff options
Diffstat (limited to 'db/click_house/main/20230707151359_create_ci_finished_builds.sql')
-rw-r--r-- | db/click_house/main/20230707151359_create_ci_finished_builds.sql | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/db/click_house/main/20230707151359_create_ci_finished_builds.sql b/db/click_house/main/20230707151359_create_ci_finished_builds.sql new file mode 100644 index 00000000000..6b1b846518d --- /dev/null +++ b/db/click_house/main/20230707151359_create_ci_finished_builds.sql @@ -0,0 +1,33 @@ +-- source table for CI analytics, almost useless on it's own, but it's a basis for creating materialized views +CREATE TABLE ci_finished_builds +( + id UInt64 DEFAULT 0, + project_id UInt64 DEFAULT 0, + pipeline_id UInt64 DEFAULT 0, + status LowCardinality(String) DEFAULT '', + + --- Fields to calculate timings + created_at DateTime64(6, 'UTC') DEFAULT now(), + queued_at DateTime64(6, 'UTC') DEFAULT now(), + finished_at DateTime64(6, 'UTC') DEFAULT now(), + started_at DateTime64(6, 'UTC') DEFAULT now(), + + runner_id UInt64 DEFAULT 0, + runner_manager_system_xid String DEFAULT '', + + --- Runner fields + runner_run_untagged Boolean DEFAULT FALSE, + runner_type UInt8 DEFAULT 0, + runner_manager_version LowCardinality(String) DEFAULT '', + runner_manager_revision LowCardinality(String) DEFAULT '', + runner_manager_platform LowCardinality(String) DEFAULT '', + runner_manager_architecture LowCardinality(String) DEFAULT '', + + --- Materialized columns + duration Int64 MATERIALIZED age('second', started_at, finished_at), + queueing_duration Int64 MATERIALIZED age('second', queued_at, started_at) + --- This table is incomplete, we'll add more fields before starting the data migration +) +ENGINE = ReplacingMergeTree -- Using ReplacingMergeTree just in case we accidentally insert the same data twice +ORDER BY (status, runner_type, project_id, finished_at, id) +PARTITION BY toYear(finished_at) |