diff --git a/Gemfile b/Gemfile index 4c81d3383..2cf9b6a1a 100644 --- a/Gemfile +++ b/Gemfile @@ -97,5 +97,3 @@ gem 'kaminari', '~> 1.2' # Encrypt attrs gem 'attr_encrypted' - -gem 'data_migrate', '~> 9.2.0' diff --git a/Gemfile.lock b/Gemfile.lock index ac306e9bf..b563b1b63 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -146,9 +146,6 @@ GEM cuprite (0.13) capybara (>= 2.1, < 4) ferrum (~> 0.11.0) - data_migrate (9.2.0) - activerecord (>= 6.1) - railties (>= 6.1) db-query-matchers (0.11.0) activesupport (>= 4.0, < 7.1) rspec (>= 3.0) @@ -460,7 +457,6 @@ DEPENDENCIES clearance counter_culture (~> 3.3) cuprite - data_migrate (~> 9.2.0) db-query-matchers delayed_job_active_record (~> 4.1) dotenv-rails diff --git a/ansible/roles/installation/tasks/main.yml b/ansible/roles/installation/tasks/main.yml index 1bdca7f43..145503f0e 100644 --- a/ansible/roles/installation/tasks/main.yml +++ b/ansible/roles/installation/tasks/main.yml @@ -77,8 +77,3 @@ command: cmd: docker compose -f docker-compose.yml -f docker-compose.prod.yml exec app bin/rails db:migrate chdir: /home/ansible - -- name: Run data migrations - command: - cmd: docker compose -f docker-compose.yml -f docker-compose.prod.yml exec app bin/rails data:migrate - chdir: /home/ansible diff --git a/db/data/20240717080438_scope_settings_to_organizations.rb b/db/data/20240717080438_scope_settings_to_organizations.rb deleted file mode 100644 index 5c7db7642..000000000 --- a/db/data/20240717080438_scope_settings_to_organizations.rb +++ /dev/null @@ -1,58 +0,0 @@ -# frozen_string_literal: true - -class ScopeSettingsToOrganizations < ActiveRecord::Migration[6.1] - def up - ActiveRecord::Base.transaction do - organization = Organization.singleton - return unless organization - - attrs = Setting.keys - attrs.each do |setting| - next unless organization.respond_to?("#{setting}=") - - organization.send("#{setting}=", Setting.send(setting)) - Rails.logger.debug '.' - end - - Setting.channels.each do |setting_key, _value| - organization.onboarding_allowed.each do |key, _value| - next unless setting_key.to_sym.eql?(key.to_sym) - - organization.onboarding_allowed[key] = Setting.channels[setting_key][:allow_onboarding] - end - end - - organization.threemarb_api_secret = ENV.fetch('THREEMARB_API_SECRET', nil) - organization.threemarb_private = ENV.fetch('THREEMARB_PRIVATE', nil) - - organization.onboarding_logo.attach(Setting.onboarding_logo) if Setting.onboarding_logo - organization.onboarding_hero.attach(Setting.onboarding_hero) if Setting.onboarding_hero - organization.channel_image.attach(Setting.channel_image) if Setting.channel_image - organization.save! - end - end - - def down - ActiveRecord::Base.transaction do - organization = Organization.singleton - return unless organization - - attrs = Setting.keys - attrs.each do |setting| - next unless organization.respond_to?("#{setting}=") - - organization.send("#{setting}=", nil) - Rails.logger.debug '.' - end - - organization.onboarding_allowed = { threema: true, telegram: true, email: true, signal: true, whats_app: true } - organization.threemarb_api_secret = nil - organization.threemarb_private = nil - - organization.onboarding_logo = nil - organization.onboarding_hero = nil - organization.channel_image = nil - organization.save! - end - end -end diff --git a/db/data/20240722092527_add_organization_id_to_requests.rb b/db/data/20240722092527_add_organization_id_to_requests.rb deleted file mode 100644 index 2943fb84d..000000000 --- a/db/data/20240722092527_add_organization_id_to_requests.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -class AddOrganizationIdToRequests < ActiveRecord::Migration[6.1] - def up - ActiveRecord::Base.transaction do - organization = Organization.singleton - return unless organization - - Request.find_each do |request| - request.organization_id = organization.id - request.save!(validate: false) - Rails.logger.debug '.' - end - end - end - - def down - ActiveRecord::Base.transaction do - organization = Organization.singleton - return unless organization - - Request.find_each do |request| - request.organization_id = nil - request.save!(validate: false) - Rails.logger.debug '.' - end - end - end -end diff --git a/db/data/20240726061113_add_organization_id_to_activity_notifications.rb b/db/data/20240726061113_add_organization_id_to_activity_notifications.rb deleted file mode 100644 index 06f348b66..000000000 --- a/db/data/20240726061113_add_organization_id_to_activity_notifications.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -class AddOrganizationIdToActivityNotifications < ActiveRecord::Migration[6.1] - def up - ActiveRecord::Base.transaction do - organization = Organization.singleton - return unless organization - - ActivityNotification.find_each do |notification| - notification.organization_id = organization.id - notification.save! - Rails.logger.debug '.' - end - end - end - - def down - ActiveRecord::Base.transaction do - organization = Organization.singleton - return unless organization - - ActivityNotification.find_each do |notification| - notification.organization_id = nil - notification.save! - Rails.logger.debug '.' - end - end - end -end diff --git a/db/data/20240726063319_add_organization_id_to_taggings.rb b/db/data/20240726063319_add_organization_id_to_taggings.rb deleted file mode 100644 index a5bd95ad5..000000000 --- a/db/data/20240726063319_add_organization_id_to_taggings.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -class AddOrganizationIdToTaggings < ActiveRecord::Migration[6.1] - def up - ActiveRecord::Base.transaction do - organization = Organization.singleton - return unless organization - - ActsAsTaggableOn::Tagging.find_each do |tag| - tag.tenant = organization.id - tag.save! - Rails.logger.debug '.' - end - end - end - - def down - ActiveRecord::Base.transaction do - organization = Organization.singleton - return unless organization - - ActsAsTaggableOn::Tagging.find_each do |tag| - tag.tenant = nil - tag.save! - Rails.logger.debug '.' - end - end - end -end diff --git a/db/data/20240730085839_rebuild_pg_search_multi_search.rb b/db/data/20240730085839_rebuild_pg_search_multi_search.rb deleted file mode 100644 index f1302a1d3..000000000 --- a/db/data/20240730085839_rebuild_pg_search_multi_search.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -class RebuildPgSearchMultiSearch < ActiveRecord::Migration[6.1] - def up - PgSearch::Multisearch.rebuild(Contributor) - PgSearch::Multisearch.rebuild(Message) - PgSearch::Multisearch.rebuild(Request) - end - - def down - PgSearch::Multisearch.rebuild(Contributor) - PgSearch::Multisearch.rebuild(Message) - PgSearch::Multisearch.rebuild(Request) - end -end diff --git a/db/data/20240812102718_migrate_users_to_users_organizations.rb b/db/data/20240812102718_migrate_users_to_users_organizations.rb deleted file mode 100644 index d049bedc2..000000000 --- a/db/data/20240812102718_migrate_users_to_users_organizations.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class MigrateUsersToUsersOrganizations < ActiveRecord::Migration[6.1] - def up - User.admin(false).find_each do |user| - UsersOrganization.create!(user_id: user.id, organization_id: user.organization_id) - end - end - - def down - UsersOrganization.destroy_all - end -end