Skip to content

Remove unnecessary groups from onboarding_progresses table

What does this MR do and why?

  • Remove groups/namespaces from onboarding_progresses table when it does not contain a learn gitlab project
  • We only use onboarding progresses table to track progress through learn gitlab and product email processes for newly onboarded users. We currently know if a group is for a newly onboarded user if a learn gitlab project is created. So we can remove all groups from this table that do not have one. We moved the onboarding process to registration only via !111622 (merged). So going forward we won't have this issue and this is a one time cleanup.

Migration

migration/rollback

❯ be rails db:migrate
main: == 20230216191507 DeleteIncorrectlyOnboardedNamespaces: migrating =============
main: -- execute("DELETE FROM onboarding_progresses\nWHERE onboarding_progresses.id NOT IN (SELECT onboarding_progresses.id\n                                 FROM onboarding_progresses\n                                          INNER JOIN namespaces\n                                                     ON namespaces.id = onboarding_progresses.namespace_id\n                                          INNER JOIN projects ON projects.namespace_id = namespaces.id\n                                 WHERE projects.name IN ('Learn GitLab', 'Learn GitLab - Ultimate trial'))\n")
main:    -> 0.0047s
main: == 20230216191507 DeleteIncorrectlyOnboardedNamespaces: migrated (0.0090s) ====

ci: == 20230216191507 DeleteIncorrectlyOnboardedNamespaces: migrating =============
ci: -- The migration is skipped since it modifies the schemas: [:gitlab_main].
ci: -- This database can only apply migrations in one of the following schemas: [:gitlab_ci, :gitlab_shared, :gitlab_internal].
ci: == 20230216191507 DeleteIncorrectlyOnboardedNamespaces: migrated (0.0061s) ====


❯ be rails db:rollback:main VERSION=20230216191507
main: == 20230216191507 DeleteIncorrectlyOnboardedNamespaces: reverting =============
main: == 20230216191507 DeleteIncorrectlyOnboardedNamespaces: reverted (0.0099s) ====
Timing - within guidelines

Screen_Shot_2023-02-16_at_3.32.23_PM

explain analysis

MR acceptance checklist

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

Related to #388970 (closed)

Edited by Doug Stull

Merge request reports