Skip to content

Disable ultimate features for public projects with 1 member and no repo

What does this MR do and why?

Disable ultimate features for public projects with 1 member and no repo

Query plan

https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/11126/commands/39871

Sample Raw SQL Query
UPDATE "project_settings"
SET "legacy_open_source_license_available" = FALSE
WHERE "project_settings"."project_id" IN (SELECT "projects"."id"
                                          FROM "projects"
                                                   LEFT OUTER JOIN project_statistics ON project_statistics.project_id = projects.id
                                                   LEFT OUTER JOIN project_settings ON project_settings.project_id = projects.id
                                                   LEFT OUTER JOIN project_authorizations
                                                                   ON project_authorizations.project_id = projects.id
                                          WHERE "projects"."id" BETWEEN 10000 AND 25000
                                            AND "projects"."visibility_level" = 20
                                            AND "projects"."id" >= 10000
                                            AND "projects"."id" < 10500
                                            AND "project_statistics"."repository_size" = 0
                                            AND "project_settings"."legacy_open_source_license_available" = TRUE
                                          GROUP BY "projects"."id"
                                          HAVING (COUNT(project_authorizations.user_id) = 1))

Migration output

up

bin/rails db:migrate:up:main VERSION=20220721031446
main: == 20220721031446 ScheduleDisableLegacyOpenSourceLicenseForOneMemberNoRepoProjects: migrating
main: == 20220721031446 ScheduleDisableLegacyOpenSourceLicenseForOneMemberNoRepoProjects: migrated (0.0273s)

down

bin/rails db:migrate:down:main VERSION=20220721031446
main: == 20220721031446 ScheduleDisableLegacyOpenSourceLicenseForOneMemberNoRepoProjects: reverting
main: == 20220721031446 ScheduleDisableLegacyOpenSourceLicenseForOneMemberNoRepoProjects: reverted (0.0096s)

Reversibility

This is a data migration that removes ultimate license from public projects with 1 member and no repo. Reversing it would not be straight and would require restoring data from an earlier snapshot.

MR acceptance checklist

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

Closes #353201

Edited by Abdul Wadood

Merge request reports

Loading