diff --git a/db/click_house/main.sql b/db/click_house/main.sql index 67acb69d9d3def512cf77e452e1258c0c08942b3..8e15abce6662d108727179c4c49d7340f39b8160 100644 --- a/db/click_house/main.sql +++ b/db/click_house/main.sql @@ -70,6 +70,7 @@ CREATE TABLE ci_finished_builds `date` Date32 MATERIALIZED toStartOfMonth(finished_at), `runner_owner_namespace_id` UInt64 DEFAULT 0, `stage_id` UInt64 DEFAULT 0, + `stage_name` String DEFAULT '', PROJECTION build_stats_by_project_pipeline_name_stage ( SELECT diff --git a/db/click_house/migrate/main/20251217120727_add_stage_name_to_ci_finished_builds.rb b/db/click_house/migrate/main/20251217120727_add_stage_name_to_ci_finished_builds.rb new file mode 100644 index 0000000000000000000000000000000000000000..ea3c8906930df2164736cae0dc438e5144b75909 --- /dev/null +++ b/db/click_house/migrate/main/20251217120727_add_stage_name_to_ci_finished_builds.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddStageNameToCiFinishedBuilds < ClickHouse::Migration + def up + execute <<~SQL + ALTER TABLE ci_finished_builds + ADD COLUMN IF NOT EXISTS `stage_name` String DEFAULT '' + SQL + end + + def down + execute <<~SQL + ALTER TABLE ci_finished_builds + DROP COLUMN IF EXISTS `stage_name` + SQL + end +end diff --git a/db/click_house/schema_migrations/main/20251217120727 b/db/click_house/schema_migrations/main/20251217120727 new file mode 100644 index 0000000000000000000000000000000000000000..c2ac88d684973b1a90f748cc0729ffeaca126e38 --- /dev/null +++ b/db/click_house/schema_migrations/main/20251217120727 @@ -0,0 +1 @@ +ca0f604dbea1f48e75b9bc81e0c68e6f1175d0cc6661c09f74cc7219ac37d61f \ No newline at end of file diff --git a/ee/spec/services/click_house/data_ingestion/ci_finished_builds_sync_service_spec.rb b/ee/spec/services/click_house/data_ingestion/ci_finished_builds_sync_service_spec.rb index d9d851e16bd8e74c18174b2cd0e39d07ea7cde17..57656ed45d71aea60a278626cd796cbd3c7d4963 100644 --- a/ee/spec/services/click_house/data_ingestion/ci_finished_builds_sync_service_spec.rb +++ b/ee/spec/services/click_house/data_ingestion/ci_finished_builds_sync_service_spec.rb @@ -271,6 +271,7 @@ def expected_build_attributes(build) date: build.finished_at.beginning_of_month, name: build.name || '', stage_id: build.stage_id || 0, + stage_name: '', root_namespace_id: build.project.root_namespace.id, runner_id: runner&.id || 0, runner_type: Ci::Runner.runner_types.fetch(runner&.runner_type, 0),