podemos-info/participa2

View on GitHub
db/migrate/20180614142735_rename_missing_features_to_components.decidim.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

# This migration comes from decidim (originally 20180613080638)

class RenameMissingFeaturesToComponents < ActiveRecord::Migration[5.1]
  class Notification < ApplicationRecord
    self.table_name = :decidim_notifications
  end

  def up
    # rubocop:disable Rails/SkipsModelValidations
    Notification.where(decidim_resource_type: "Decidim::Feature").update_all(decidim_resource_type: "Decidim::Component")
    Notification.where(event_class: "Decidim::FeaturePublishedEvent").update_all(event_class: "Decidim::ComponentPublishedEvent")
    Notification.where(event_name: "decidim.events.features.feature_published").update_all(event_name: "decidim.events.components.component_published")
    # rubocop:enable Rails/SkipsModelValidations
  end
end