Sha256: d8c5bc539e22562240fc2dc54f1e3908318b791f83f79cdcfe557c52e79fa0ad

Contents?: true

Size: 925 Bytes

Versions: 6

Compression:

Stored size: 925 Bytes

Contents

# frozen_string_literal: true

class MoveParagraphEndorsedEventNotificationsToResourceEndorsedEvent < ActiveRecord::Migration[5.2]
  def up
    Decidim::Notification.where(event_name: "decidim.events.enhanced_textwork.paragraph_endorsed", event_class: "Decidim::EnhancedTextwork::ParagraphEndorsedEvent").find_each do |notification|
      notification.update(event_name: "decidim.events.resource_endorsed", event_class: "Decidim::ResourceEndorsedEvent")
    end
  end

  def down
    Decidim::Notification.where(
      event_name: "decidim.events.resource_endorsed",
      event_class: "Decidim::ResourceEndorsedEvent",
      decidim_resource_type: "Decidim::EnhancedTextwork::Paragraph"
    )
                         .find_each do |notification|
      notification.update(event_name: "decidim.events.enhanced_textwork.paragraph_endorsed", event_class: "Decidim::EnhancedTextwork::ParagraphEndorsedEvent")
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-enhanced_textwork-1.0.5 db/migrate/20200730131631_move_paragraph_endorsed_event_notifications_to_resource_endorsed_event.rb
decidim-enhanced_textwork-1.0.4 db/migrate/20200730131631_move_paragraph_endorsed_event_notifications_to_resource_endorsed_event.rb
decidim-enhanced_textwork-1.0.3 db/migrate/20200730131631_move_paragraph_endorsed_event_notifications_to_resource_endorsed_event.rb
decidim-enhanced_textwork-1.0.2 db/migrate/20200730131631_move_paragraph_endorsed_event_notifications_to_resource_endorsed_event.rb
decidim-enhanced_textwork-1.0.1 db/migrate/20200730131631_move_paragraph_endorsed_event_notifications_to_resource_endorsed_event.rb
decidim-enhanced_textwork-1.0.0 db/migrate/20200730131631_move_paragraph_endorsed_event_notifications_to_resource_endorsed_event.rb