diff options
author | Nick Thomas <nick@gitlab.com> | 2019-06-13 16:12:28 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-07-23 18:53:03 +0300 |
commit | 4aa76dddecc048cef24963323afe59f1c120cb72 (patch) | |
tree | 0a15518b73ee1646d09161954cbefb577d249138 /db/post_migrate | |
parent | d892e80bf0161b535389c91ccb53539e4f08d790 (diff) |
Remove dead MySQL code
None of this code can be reached any more, so it can all be removed
Diffstat (limited to 'db/post_migrate')
4 files changed, 13 insertions, 53 deletions
diff --git a/db/post_migrate/20180409170809_populate_missing_project_ci_cd_settings.rb b/db/post_migrate/20180409170809_populate_missing_project_ci_cd_settings.rb index 0cda3d76a3d..a400a071e07 100644 --- a/db/post_migrate/20180409170809_populate_missing_project_ci_cd_settings.rb +++ b/db/post_migrate/20180409170809_populate_missing_project_ci_cd_settings.rb @@ -9,10 +9,6 @@ class PopulateMissingProjectCiCdSettings < ActiveRecord::Migration[4.2] disable_ddl_transaction! def up - # MySQL does not support online upgrades, thus there can't be any missing - # rows. - return if Gitlab::Database.mysql? - # Projects created after the initial migration but before the code started # using ProjectCiCdSetting won't have a corresponding row in # project_ci_cd_settings, so let's fix that. diff --git a/db/post_migrate/20181219130552_update_project_import_visibility_level.rb b/db/post_migrate/20181219130552_update_project_import_visibility_level.rb index 6209de88b31..bfa452578a3 100644 --- a/db/post_migrate/20181219130552_update_project_import_visibility_level.rb +++ b/db/post_migrate/20181219130552_update_project_import_visibility_level.rb @@ -49,7 +49,7 @@ class UpdateProjectImportVisibilityLevel < ActiveRecord::Migration[5.0] def update_projects_visibility(visibility) say_with_time("Updating project visibility to #{visibility} on #{Project::IMPORT_TYPE} imports.") do Project.with_group_visibility(visibility).select(:id).each_batch(of: BATCH_SIZE) do |batch, _index| - batch_sql = Gitlab::Database.mysql? ? batch.pluck(:id).join(', ') : batch.select(:id).to_sql + batch_sql = batch.select(:id).to_sql say("Updating #{batch.size} items.", true) diff --git a/db/post_migrate/20190204115450_migrate_auto_dev_ops_domain_to_cluster_domain.rb b/db/post_migrate/20190204115450_migrate_auto_dev_ops_domain_to_cluster_domain.rb index 392e64eeade..036b0b64b48 100644 --- a/db/post_migrate/20190204115450_migrate_auto_dev_ops_domain_to_cluster_domain.rb +++ b/db/post_migrate/20190204115450_migrate_auto_dev_ops_domain_to_cluster_domain.rb @@ -16,26 +16,6 @@ class MigrateAutoDevOpsDomainToClusterDomain < ActiveRecord::Migration[5.0] private def update_clusters_domain_query - if Gitlab::Database.mysql? - mysql_query - else - postgresql_query - end - end - - def mysql_query - <<~HEREDOC - UPDATE clusters, project_auto_devops, cluster_projects - SET - clusters.domain = project_auto_devops.domain - WHERE - cluster_projects.cluster_id = clusters.id - AND project_auto_devops.project_id = cluster_projects.project_id - AND project_auto_devops.domain != '' - HEREDOC - end - - def postgresql_query <<~HEREDOC UPDATE clusters SET domain = project_auto_devops.domain diff --git a/db/post_migrate/20190404143330_add_unique_constraint_to_approvals_user_id_and_merge_request_id.rb b/db/post_migrate/20190404143330_add_unique_constraint_to_approvals_user_id_and_merge_request_id.rb index 447f91ebc7e..dd85ebc8001 100644 --- a/db/post_migrate/20190404143330_add_unique_constraint_to_approvals_user_id_and_merge_request_id.rb +++ b/db/post_migrate/20190404143330_add_unique_constraint_to_approvals_user_id_and_merge_request_id.rb @@ -21,34 +21,18 @@ class AddUniqueConstraintToApprovalsUserIdAndMergeRequestId < ActiveRecord::Migr def remove_duplicates add_concurrent_index :approvals, [:user_id, :merge_request_id, :id] - if Gitlab::Database.mysql? - execute <<-SQL - DELETE FROM a - USING approvals AS a - INNER JOIN ( - SELECT user_id, merge_request_id, MIN(id) as min_id - FROM approvals - GROUP BY user_id, merge_request_id - HAVING COUNT(id) > 1 - ) as approvals_with_duplicates - ON approvals_with_duplicates.user_id = a.user_id - AND approvals_with_duplicates.merge_request_id = a.merge_request_id - WHERE approvals_with_duplicates.min_id <> a.id; - SQL - else - execute <<-SQL - DELETE FROM approvals - USING ( - SELECT user_id, merge_request_id, MIN(id) as min_id - FROM approvals - GROUP BY user_id, merge_request_id - HAVING COUNT(id) > 1 - ) as approvals_with_duplicates - WHERE approvals_with_duplicates.user_id = approvals.user_id - AND approvals_with_duplicates.merge_request_id = approvals.merge_request_id - AND approvals_with_duplicates.min_id <> approvals.id; - SQL - end + execute <<-SQL + DELETE FROM approvals + USING ( + SELECT user_id, merge_request_id, MIN(id) as min_id + FROM approvals + GROUP BY user_id, merge_request_id + HAVING COUNT(id) > 1 + ) as approvals_with_duplicates + WHERE approvals_with_duplicates.user_id = approvals.user_id + AND approvals_with_duplicates.merge_request_id = approvals.merge_request_id + AND approvals_with_duplicates.min_id <> approvals.id; + SQL remove_concurrent_index :approvals, [:user_id, :merge_request_id, :id] end |