Skip to content

Backfill design_management_repositories table

Aakriti Gupta requested to merge ag-backfill-design-repos into master

What does this MR do and why?

Describe in detail what your merge request does and why.

This MR backfills the design_management_repositories table to be used in !113958 (merged).

It was introduced in !111555 (merged)

Following up from this note, the model is added to import_export.yml

Related issue: #391191 (closed)

Raw SQL

INSERT INTO design_management_repositories (project_id, created_at, updated_at)
SELECT projects.id,
       now(),
       now()
FROM projects
WHERE projects.id IN
    (SELECT "projects"."id"
     FROM "projects"
     LEFT OUTER JOIN design_management_repositories ON design_management_repositories.project_id = projects.id
     WHERE "projects"."id" BETWEEN 1 AND 19
       AND "design_management_repositories"."project_id" IS NULL
       AND "projects"."id" >= 1) ON CONFLICT (project_id) DO NOTHING;

Query plan/explain: https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/16105/commands/55422

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

  1. rails db:migrate
  2. In rails console check Project.count == DesignManagement::Repository.count

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Aakriti Gupta

Merge request reports