Sha256: e3f15308b2b43e07466ac9e6c3fe68014d5643b31f310bbd0350dad09112560a
Contents?: true
Size: 1.31 KB
Versions: 64
Compression:
Stored size: 1.31 KB
Contents
# frozen_string_literal: true class RenameFeaturesToComponents < ActiveRecord::Migration[5.1] class ActionLog < ApplicationRecord self.table_name = :decidim_action_logs end class Version < ApplicationRecord self.table_name = :versions end def change rename_table :decidim_features, :decidim_components rename_column :decidim_action_logs, :decidim_feature_id, :decidim_component_id rename_index :decidim_action_logs, "index_action_logs_on_feature_id", "index_action_logs_on_component_id" if index_name_exists?(:decidim_components, "index_decidim_features_on_decidim_participatory_space") rename_index :decidim_components, "index_decidim_features_on_decidim_participatory_space", "index_decidim_components_on_decidim_participatory_space" end # rubocop:disable Rails/SkipsModelValidations Version.where(item_type: "Decidim::Feature").update_all(item_type: "Decidim::Component") ActionLog.where(resource_type: "Decidim::Feature").update_all(resource_type: "Decidim::Component") # rubocop:enable Rails/SkipsModelValidations ActionLog.find_each do |log| new_extra = log.extra.dup next if new_extra["component"].present? new_extra["component"] = new_extra["feature"] new_extra.delete("feature") log.extra = new_extra log.save! end end end
Version data entries
64 entries across 64 versions & 1 rubygems