From d7c373509aef580ee8611bc5b4d03609b2954111 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Mon, 9 Dec 2024 15:02:18 +0100 Subject: [PATCH] Remove tasks to upgrade to version 2.2 Note that, while we're no longer including them as part of the `execute_release_2.2.0_tasks` task, we're keeping the tasks to remove duplicate poll voters and poll options just in case there are some unexpected issues when adding a unique database index while upgrading to version 2.3.0. We'll remove them in version 2.4.0. --- lib/tasks/consul.rake | 10 +++------- lib/tasks/db.rake | 11 ----------- spec/lib/tasks/db_spec.rb | 27 --------------------------- 3 files changed, 3 insertions(+), 45 deletions(-) delete mode 100644 spec/lib/tasks/db_spec.rb diff --git a/lib/tasks/consul.rake b/lib/tasks/consul.rake index 64225f60b..a43bdaaf6 100644 --- a/lib/tasks/consul.rake +++ b/lib/tasks/consul.rake @@ -3,12 +3,8 @@ namespace :consul do task execute_release_tasks: ["settings:rename_setting_keys", "settings:add_new_settings", "cache:clear", - "execute_release_2.2.0_tasks"] + "execute_release_2.3.0_tasks"] - desc "Runs tasks needed to upgrade from 2.1.1 to 2.2.0" - task "execute_release_2.2.0_tasks": [ - "db:mask_ips", - "polls:remove_duplicate_voters", - "polls:populate_option_id" - ] + desc "Runs tasks needed to upgrade from 2.2.2 to 2.3.0" + task "execute_release_2.3.0_tasks": [] end diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake index c8b50e7cc..3c1d00166 100644 --- a/lib/tasks/db.rake +++ b/lib/tasks/db.rake @@ -4,15 +4,4 @@ namespace :db do I18n.enforce_available_locales = false Tenant.switch(args[:tenant]) { load(Rails.root.join("db", "dev_seeds.rb")) } end - - desc "Mask IPs collected with Ahoy" - task mask_ips: :environment do - ApplicationLogger.new.info "Masking tracked IPs collected with Ahoy" - - Tenant.run_on_each do - Visit.find_each do |visit| - visit.update_column :ip, Ahoy.mask_ip(visit.ip) - end - end - end end diff --git a/spec/lib/tasks/db_spec.rb b/spec/lib/tasks/db_spec.rb deleted file mode 100644 index 084128d2e..000000000 --- a/spec/lib/tasks/db_spec.rb +++ /dev/null @@ -1,27 +0,0 @@ -require "rails_helper" - -describe "rake db:mask_ips" do - before { Rake::Task["db:mask_ips"].reenable } - - it "mask IPs on all tenants" do - create(:visit, ip: "1.1.1.1") - create(:visit, ip: "1.1.1.2") - create(:visit, ip: "1.1.2.2") - - create(:tenant, schema: "myhometown") - - Tenant.switch("myhometown") do - create(:visit, ip: "1.1.1.1") - create(:visit, ip: "1.1.1.2") - create(:visit, ip: "1.1.3.3") - end - - Rake.application.invoke_task("db:mask_ips") - - expect(Visit.pluck(:ip)).to match_array %w[1.1.1.0 1.1.1.0 1.1.2.0] - - Tenant.switch("myhometown") do - expect(Visit.pluck(:ip)).to match_array %w[1.1.1.0 1.1.1.0 1.1.3.0] - end - end -end