gitlab-org--gitlab-foss/db/post_migrate
Yorick Peterse 4b9c17f196
Move Project#rename_repo to a service class
This moves the logic of Project#rename_repo and all methods _only_ used
by this method into a new service class: Projects::AfterRenameService.
By moving this code into a separate service class we can more easily
refactor it, and we also get rid of some RuboCop "disable" statements
automatically.

During the refactoring of this code, I removed most of the explicit
logging using Gitlab::AppLogger. The data that was logged would not be
useful when debugging renaming issues, as it does not add any value on
top of data provided by users.

I also removed a variety of comments that either mentioned something the
code does in literal form, or contained various grammatical errors.
Instead we now resort to more clearly named methods, removing the need
for code comments.

This method was chosen based on analysis in
https://gitlab.com/gitlab-org/release/framework/issues/28. In this issue
we determined this method has seen a total of 293 lines being changed in
it. We also noticed that RuboCop determined the ABC size
(https://www.softwarerenovation.com/ABCMetric.pdf) was too great.
2018-10-22 15:12:46 +02:00
..
.gitkeep
20160824121037_change_personal_access_tokens_default_back_to_empty_array.rb
20161011222551_remove_inactive_jira_service_properties.rb
20161109150329_fix_project_records_with_invalid_visibility.rb [Rails5] Fix Arel::UpdateManager calls 2018-06-06 20:15:46 +11:00
20161128170531_drop_user_activities_table.rb
20161221140236_remove_unneeded_services.rb
20161221153951_rename_reserved_project_names.rb Move Project#rename_repo to a service class 2018-10-22 15:12:46 +02:00
20170104150317_requeue_pending_delete_projects.rb
20170106142508_fill_authorized_projects.rb
20170106172224_remove_project_authorizations_id_column.rb
20170131214021_reset_users_authorized_projects_populated.rb Prevent update_column_in_batches on large tables 2017-11-17 16:56:50 +00:00
20170206040400_remove_inactive_default_email_services.rb
20170206101007_remove_trackable_columns_from_timelogs.rb
20170206101030_validate_foreign_keys_on_timelogs.rb
20170209140523_validate_foreign_keys_on_oauth_openid_requests.rb
20170211073944_disable_invalid_service_templates.rb
20170214111112_delete_deprecated_gitlab_ci_service.rb
20170215200045_remove_theme_id_from_users.rb
20170301205640_migrate_build_events_to_pipeline_events.rb
20170306170512_migrate_legacy_manual_actions.rb
20170309171644_reset_relative_position_for_issue.rb Prevent update_column_in_batches on large tables 2017-11-17 16:56:50 +00:00
20170313133418_rename_more_reserved_project_names.rb Move Project#rename_repo to a service class 2018-10-22 15:12:46 +02:00
20170317162059_update_upload_paths_to_system.rb
20170324160416_migrate_user_activities_to_users_last_activity_on.rb [Rails5] Fix Arel::UpdateManager calls 2018-06-06 20:15:46 +11:00
20170404170532_remove_notes_original_discussion_id.rb
20170406111121_clean_upload_symlinks.rb Adds Rubocop rule for line break after guard clause 2017-11-16 17:58:29 +01:00
20170406142253_migrate_user_project_view.rb Prevent update_column_in_batches on large tables 2017-11-17 16:56:50 +00:00
20170408033905_remove_old_cache_directories.rb
20170412174900_rename_reserved_dynamic_paths.rb
20170425121605_migrate_trigger_schedules_to_pipeline_schedules.rb
20170425130047_drop_ci_trigger_schedules_table.rb Enable rubocop for db/**/* and ee/db/**/* 2018-07-25 17:47:12 +08:00
20170502070007_enable_auto_cancel_pending_pipelines_for_all.rb disable_statement_timeout doesn't require any argument anymore 2018-08-11 04:15:59 +02:00
20170502101023_cleanup_namespaceless_pending_delete_projects.rb
20170503004427_update_retried_for_ci_build.rb disable_statement_timeout doesn't require any argument anymore 2018-08-11 04:15:59 +02:00
20170503120310_remove_users_authorized_projects_populated.rb
20170508170547_add_head_pipeline_for_each_merge_request.rb disable_statement_timeout doesn't require any argument anymore 2018-08-11 04:15:59 +02:00
20170510101043_add_foreign_key_on_pipeline_schedule_owner.rb
20170511100900_cleanup_rename_web_hooks_build_events_to_job_events.rb
20170511101000_cleanup_rename_services_build_events_to_job_events.rb
20170516165238_cleanup_trigger_for_issues.rb
20170516181025_add_constraints_to_issue_assignees_table.rb
20170518200835_rename_users_with_renamed_namespace.rb Adds Rubocop rule for line break around conditionals 2018-01-11 16:34:01 +00:00
20170518231126_fix_wrongly_renamed_routes.rb Prevent update_column_in_batches on large tables 2017-11-17 16:56:50 +00:00
20170523073948_remove_assignee_id_from_issue.rb Add spec for removing issues.assignee_id 2017-12-11 14:09:55 +00:00
20170523083112_migrate_old_artifacts.rb
20170525140254_rename_all_reserved_paths_again.rb disable_statement_timeout doesn't require any argument anymore 2018-08-11 04:15:59 +02:00
20170526185842_migrate_pipeline_stages.rb disable_statement_timeout doesn't require any argument anymore 2018-08-11 04:15:59 +02:00
20170526185858_create_index_in_pipeline_stages.rb
20170526185901_remove_stage_id_index_from_builds.rb
20170526185921_migrate_build_stage_reference.rb
20170526190000_migrate_build_stage_reference_again.rb disable_statement_timeout doesn't require any argument anymore 2018-08-11 04:15:59 +02:00
20170531203055_cleanup_users_ldap_email_rename.rb Enable rubocop for db/**/* and ee/db/**/* 2018-07-25 17:47:12 +08:00
20170606202615_move_appearance_to_system_dir.rb
20170607121233_convert_custom_notification_settings_to_columns.rb
20170609183112_remove_position_from_issuables.rb
20170612071012_move_personal_snippets_files.rb Adds Rubocop rule for line break after guard clause 2017-11-16 17:58:29 +01:00
20170613111224_clean_appearance_symlinks.rb Adds Rubocop rule for line break after guard clause 2017-11-16 17:58:29 +01:00
20170621102400_add_stage_id_index_to_builds.rb
20170627101016_schedule_event_migrations.rb Consistently schedule Sidekiq jobs 2017-12-05 11:59:39 +01:00
20170628080858_migrate_stage_id_reference_in_background.rb
20170629180131_cleanup_application_settings_signin_enabled_rename.rb
20170703130158_schedule_merge_request_diff_migrations.rb
20170711145558_migrate_stages_statuses.rb disable_statement_timeout doesn't require any argument anymore 2018-08-11 04:15:59 +02:00
20170717111152_cleanup_move_system_upload_folder_symlink.rb Fix a transient failure in db/post_migrate/20170717111152_cleanup_move_system_upload_folder_symlink.rb where symlink already exists 2018-02-12 16:54:22 +01:00
20170717150329_enqueue_migrate_system_uploads_to_new_folder.rb
20170719150301_merge_issuable_reopened_into_opened_state.rb
20170728101014_remove_events_from_notification_settings.rb
20170803090603_calculate_conv_dev_index_percentages.rb
20170807160457_remove_locked_at_column_from_merge_requests.rb
20170807190736_move_personal_snippet_files_into_correct_folder.rb
20170815060945_remove_duplicate_mr_events.rb
20170816102555_cleanup_nonexisting_namespace_pending_delete_projects.rb
20170822101017_migrate_pipeline_sidekiq_queues.rb
20170828170502_post_deploy_migrate_user_external_mail_data.rb Fix PG::UniqueViolation external_email migration 2017-09-25 06:17:48 -04:00
20170828170513_remove_user_email_provider_column.rb
20170828170516_remove_user_external_mail_columns.rb
20170830084744_destroy_gpg_signatures.rb
20170830150306_drop_events_for_migration_table.rb Enable rubocop for db/**/* and ee/db/**/* 2018-07-25 17:47:12 +08:00
20170831195038_remove_valid_signature_from_gpg_signatures.rb
20170907170235_delete_conflicting_redirect_routes.rb Make DeleteConflictingRedirectRoutes no-op 2018-01-03 12:23:20 -08:00
20170913180600_fix_projects_without_project_feature.rb Add data migration 2017-09-15 14:45:21 -03:00
20170921101004_normalize_ldap_extern_uids.rb Move migration to background 2017-10-07 10:28:13 -07:00
20170926150348_schedule_merge_request_diff_migrations_take_two.rb Reschedule merge request diff background migration 2017-09-29 11:56:08 +01:00
20170927112318_update_legacy_diff_notes_type_for_import.rb Prevent update_column_in_batches on large tables 2017-11-17 16:56:50 +00:00
20170927112319_update_notes_type_for_import.rb Prevent update_column_in_batches on large tables 2017-11-17 16:56:50 +00:00
20171005130944_schedule_create_gpg_key_subkeys_from_gpg_keys.rb Consistently schedule Sidekiq jobs 2017-12-05 11:59:39 +01:00
20171012150314_remove_user_authentication_token.rb Remove user authentication_token column 2017-11-02 11:39:03 +01:00
20171013104327_migrate_gcp_clusters_to_new_clusters_architectures.rb Remove cluster_id from 20171013104327_migrate_gcp_clusters_to_new_clusters_architectures 2017-11-23 20:42:20 +09:00
20171026082505_schedule_merge_request_latest_merge_request_diff_id_migrations.rb Convert migration to populate latest merge request ID into a background migration 2017-11-17 10:23:48 +00:00
20171101134435_remove_ref_fetched_from_merge_requests.rb make the migration reversible 2017-11-03 08:13:11 -04:00
20171103140253_track_untracked_uploads.rb Move temp table creation into the prepare job 2017-12-01 15:26:41 -08:00
20171106133144_cleanup_application_settings_password_authentication_enabled_rename.rb Allow password authentication to be disabled entirely 2017-11-23 13:16:14 +00:00
20171106154015_remove_issues_branch_name.rb Enable rubocop for db/**/* and ee/db/**/* 2018-07-25 17:47:12 +08:00
20171106180641_cleanup_add_timezone_to_issues_closed_at.rb Enable rubocop for db/**/* and ee/db/**/* 2018-07-25 17:47:12 +08:00
20171114104051_remove_empty_fork_networks.rb Delete orphaned fork networks in a migration 2017-11-17 12:58:15 +01:00
20171121160421_remove_merge_request_diff_st_commits_and_st_diffs.rb Remove serialised diff and commit columns 2017-11-28 16:13:40 +00:00
20171123101020_update_circuitbreaker_defaults.rb Move the circuitbreaker check out in a separate process 2017-12-08 09:11:39 +01:00
20171123101046_remove_old_circuitbreaker_config.rb Move the circuitbreaker check out in a separate process 2017-12-08 09:11:39 +01:00
20171124095655_add_index_on_merge_request_diffs_merge_request_id_and_id.rb Improve indexes on merge_request_diffs 2017-11-28 16:13:57 +00:00
20171124100152_remove_index_on_merge_request_diffs_merge_request_diff_id.rb Improve indexes on merge_request_diffs 2017-11-28 16:13:57 +00:00
20171124104327_migrate_kubernetes_service_to_new_clusters_architectures.rb Fix missing key change in 20171124104327_migrate_kubernetes_service_to_new_clusters_architectures.rb 2018-06-02 06:14:58 -07:00
20171124150326_reschedule_fork_network_creation.rb Early migrations populating fork-networks: no-op 2018-02-08 09:44:58 +01:00
20171128214150_schedule_populate_merge_request_metrics_with_events_data.rb Enable rubocop for db/**/* and ee/db/**/* 2018-07-25 17:47:12 +08:00
20171205190711_reschedule_fork_network_creation_caller.rb The API isn't using the appropriate services for managing forks 2017-12-07 08:44:55 +00:00
20171207150300_remove_project_labels_group_id_copy.rb fix rubocop 2018-02-03 10:42:44 +01:00
20171207150343_remove_soft_removed_objects.rb disable_statement_timeout doesn't require any argument anymore 2018-08-11 04:15:59 +02:00
20171207150344_remove_deleted_at_columns.rb Remove soft removals related code 2018-01-08 17:04:45 +01:00
20171213160445_migrate_github_importer_advance_stage_sidekiq_queue.rb Remove unused queues 2017-12-13 16:28:27 +01:00
20171215121205_post_populate_can_push_from_deploy_keys_projects.rb Applied fix 2018-01-17 21:42:18 +01:00
20171215121259_remove_can_push_from_keys.rb Merge branch 'sh-migrate-can-push-to-deploy-keys-projects-10-3' into 'security-10-3' 2018-01-16 17:04:51 -08:00
20171219121201_normalize_extern_uid_from_identities.rb LDAP extern_uids are not normalized when updated via API 2017-12-21 14:31:15 +00:00
20171221140220_schedule_issues_closed_at_type_change.rb Ignore the Migration/Datetime cop in a migration that fix a column type to datetime_with_timezone 2018-01-04 22:36:11 +01:00
20180104131052_schedule_set_confidential_note_events_on_webhooks.rb Merge branch 'jej/mattermost-notification-confidentiality-10-6' into 'security-10-6' 2018-04-05 08:41:56 +02:00
20180119121225_remove_redundant_pipeline_stages.rb disable_statement_timeout doesn't require any argument anymore 2018-08-11 04:15:59 +02:00
20180122154930_schedule_set_confidential_note_events_on_services.rb Merge branch 'jej/mattermost-notification-confidentiality-10-6' into 'security-10-6' 2018-04-05 08:41:56 +02:00
20180202111106_remove_project_labels_group_id.rb add migration 2018-02-02 06:35:40 -08:00
20180204200836_change_author_id_to_not_null_in_todos.rb Set todos#author_id to NOT NULL. 2018-02-05 16:16:57 +01:00
20180212101828_add_tmp_partial_null_index_to_builds.rb Create index on id instead of stage_id in migration 2018-02-21 09:27:07 +01:00
20180212101928_schedule_build_stage_migration.rb Reschedule pipeline stages migration to run it again 2018-04-05 10:54:33 +02:00
20180212102028_remove_tmp_partial_null_index_from_builds.rb Create index on id instead of stage_id in migration 2018-02-21 09:27:07 +01:00
20180216121020_fill_pages_domain_verification_code.rb Add DNS verification to Pages custom domains 2018-02-23 12:22:29 +00:00
20180216121030_enqueue_verify_pages_domain_workers.rb Add DNS verification to Pages custom domains 2018-02-23 12:22:29 +00:00
20180220150310_remove_empty_extern_uid_auth0_identities.rb Merge branch 'fix/auth0-unsafe-login-10-6' into 'security-10-6' 2018-03-21 14:43:47 +00:00
20180223124427_build_user_interacted_projects_table.rb Enable rubocop for db/**/* and ee/db/**/* 2018-07-25 17:47:12 +08:00
20180301084653_change_project_namespace_id_not_null.rb Make project#namespace_id not null 2018-03-01 11:00:34 +02:00
20180305100050_remove_permanent_from_redirect_routes.rb disable_statement_timeout doesn't require any argument anymore 2018-08-11 04:15:59 +02:00
20180306074045_migrate_create_trace_artifact_sidekiq_queue.rb Integrate two workers into one ArchiveTraceWorker with pipeline_background queue. This queue takes loqer precedence than pipeline_default. 2018-03-06 21:44:15 +09:00
20180306164012_add_path_index_to_redirect_routes.rb disable_statement_timeout doesn't require any argument anymore 2018-08-11 04:15:59 +02:00
20180307012445_migrate_update_head_pipeline_for_merge_request_sidekiq_queue.rb Move update_head_pipeline_for_merge_request queue to pipeline_processing namespace 2018-03-07 01:39:00 +09:00
20180405101928_reschedule_builds_stages_migration.rb disable_statement_timeout doesn't require any argument anymore 2018-08-11 04:15:59 +02:00
20180408143355_cleanup_users_rss_token_rename.rb Enable rubocop for db/**/* and ee/db/**/* 2018-07-25 17:47:12 +08:00
20180409170809_populate_missing_project_ci_cd_settings.rb Introduce new ProjectCiCdSetting 2018-04-16 14:05:35 +02:00
20180420080616_schedule_stages_index_migration.rb disable_statement_timeout doesn't require any argument anymore 2018-08-11 04:15:59 +02:00
20180424151928_fill_file_store.rb Enable rubocop for db/**/* and ee/db/**/* 2018-07-25 17:47:12 +08:00
20180430143705_backfill_runner_type_for_ci_runners_post_migrate.rb Enable rubocop for db/**/* and ee/db/**/* 2018-07-25 17:47:12 +08:00
20180502134117_migrate_import_attributes_data_from_projects_to_project_mirror_data.rb Enable rubocop for db/**/* and ee/db/**/* 2018-07-25 17:47:12 +08:00
20180507083701_set_minimal_project_build_timeout.rb Enable rubocop for db/**/* and ee/db/**/* 2018-07-25 17:47:12 +08:00
20180511174224_add_unique_constraint_to_project_features_project_id.rb Add a unique and not null constraint on the project_features.project_id column 2018-05-15 14:20:14 +02:00
20180512061621_add_not_null_constraint_to_project_features_project_id.rb Add a unique and not null constraint on the project_features.project_id column 2018-05-15 14:20:14 +02:00
20180514161336_remove_gemnasium_service.rb Resolve "Deprecate Gemnasium project service" 2018-05-23 09:40:45 +00:00
20180521162137_migrate_remaining_mr_metrics_populating_background_migration.rb Take two for MR metrics population background migration 2018-05-30 11:51:29 -03:00
20180523125103_cleanup_merge_requests_allow_maintainer_to_push_rename.rb Enable rubocop for db/**/* and ee/db/**/* 2018-07-25 17:47:12 +08:00
20180529152628_schedule_to_archive_legacy_traces.rb Add type_build to ScheduleToArchiveLegacyTraces::Build 2018-06-04 14:14:20 +09:00
20180603190921_migrate_object_storage_upload_sidekiq_queue.rb Migrate jobs in object_storage_upload queue 2018-06-05 20:37:01 +02:00
20180604123514_cleanup_stages_position_migration.rb disable_statement_timeout doesn't require any argument anymore 2018-08-11 04:15:59 +02:00
20180608201435_cleanup_merge_requests_allow_collaboration_rename.rb Revert rename allow collaboration column 2018-06-08 13:12:51 +00:00
20180619121030_enqueue_delete_diff_files_workers.rb Use schedulers and delete diff files upon deadtuples check 2018-07-10 10:25:48 -03:00
20180629191052_add_partial_index_to_projects_for_last_repository_check_at.rb Backport partial index to find repositories that have not been checked 2018-07-02 15:40:18 -07:00
20180702120647_enqueue_fix_cross_project_label_links.rb Migration which fixes cross-project label references 2018-07-03 21:21:36 +02:00
20180704145007_update_project_indexes.rb Enable rubocop for db/**/* and ee/db/**/* 2018-07-25 17:47:12 +08:00
20180706223200_populate_site_statistics.rb Added SiteStatistics as counter cache for Projects and Wikis 2018-07-24 18:44:07 +02:00
20180723130817_delete_inconsistent_internal_id_records.rb Add migration to cleanup internal_ids. 2018-08-17 11:38:53 +02:00
20180809195358_migrate_null_wiki_access_levels.rb Add site statistics recount to the post migiration 2018-08-16 21:31:19 +02:00
20180816161409_migrate_legacy_artifacts_to_job_artifacts.rb Squashed commit of the following: 2018-08-27 09:12:02 +02:00
20180816193530_rename_login_root_namespaces.rb Fix rename_login_root_namespaces post migration 2018-10-02 09:46:23 -06:00
20180826111825_recalculate_site_statistics.rb recalculate SiteStatistics 2018-08-26 11:24:55 +02:00
20180906051323_remove_orphaned_label_links.rb Remove orphaned label links 2018-09-07 07:38:44 -07:00
20180913051323_consume_remaining_diff_files_deletion_jobs.rb Add clean-up phase for ScheduleDiffFilesDeletion 2018-09-25 11:41:35 -03:00
20180914162043_encrypt_web_hooks_columns.rb Migrate sensitive web hook data in the background 2018-10-01 15:34:16 +01:00
20180914201132_remove_sidekiq_throttling_from_application_settings.rb Remove background job throttling feature 2018-09-24 18:41:14 +03:00
20180916014356_populate_external_pipeline_source.rb Schedule background migration 2018-09-25 21:09:14 +02:00
20180917172041_remove_wikis_count_from_site_statistics.rb Geo: sync disabled wikis. Stage 2 2018-09-25 17:49:39 +03:00
20181008145341_steal_encrypt_columns.rb Remove unencrypted webhook token and URL columns 2018-10-09 11:15:02 +01:00
20181008145359_remove_web_hooks_token_and_url.rb Remove unencrypted webhook token and URL columns 2018-10-09 11:15:02 +01:00
20181008200441_remove_circuit_breaker.rb Remove Git circuit breaker 2018-10-10 09:08:18 +02:00
20181013005024_remove_koding_from_application_settings.rb Remove Koding integration and documentation 2018-10-12 22:18:51 -07:00