Add AI config activation timestamps to `ci_project_metrics`
What does this MR do and why?
Adds two nullable timestamptz columns to ci_project_metrics in support of the Pipeline Results Reviewed funnel step for the AI Pipeline Builder / CI Expert Agent (CI Expert Agent — Success Metrics (Simplified, GA) (#594029)):
ci_config_first_generated_at— the time the agent first committed CI config for the project. Anchors the activation window and acts as the time-gate for the upcomingview_ai_pipeline_resultsevent (a viewed pipeline counts as a "review" only if it was created at/after this time).first_ai_pipeline_results_viewed_at— idempotency gate for theview_ai_pipeline_resultsevent, so it fires at most once per project (same once-per-project shape asfirst_pipeline_succeeded_at).
This is the migration-only MR. The application logic that reads and writes these columns follows in a subsequent MR. Both columns ship NULL everywhere until then.
Database
Two nullable column additions to an existing small table (ci_project_metrics, gitlab_schema: gitlab_ci, sharding key project_id).
No new queries are introduced by this MR, so there are no query plans to provide.
Migration up
== 20260610120000 AddAiConfigTimestampsToCiProjectMetrics: migrating ==========
-- add_column(:ci_project_metrics, :ci_config_first_generated_at, :datetime_with_timezone, {:null=>true, :if_not_exists=>true})
-- add_column(:ci_project_metrics, :first_ai_pipeline_results_viewed_at, :datetime_with_timezone, {:null=>true, :if_not_exists=>true})
== 20260610120000 AddAiConfigTimestampsToCiProjectMetrics: migrated =Migration down
== 20260610120000 AddAiConfigTimestampsToCiProjectMetrics: reverting ==========
-- remove_column(:ci_project_metrics, :ci_config_first_generated_at, {:if_exists=>true})
-- remove_column(:ci_project_metrics, :first_ai_pipeline_results_viewed_at, {:if_exists=>true})
== 20260610120000 AddAiConfigTimestampsToCiProjectMetrics: reverted (0.0636s) =How to set up and validate locally
bundle exec rails db:migrate
bundle exec rails db:rollbackMR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related: Identify agent-generated pipeline configs using... (#596636 - closed), CI Expert Agent — Success Metrics (Simplified, GA) (#594029)