Sha256: b361c8fb990b44f0c157de6047b859500b121c6babc2a0ab1c2a004dc898c8ee

Contents?: true

Size: 327 Bytes

Versions: 4

Compression:

Stored size: 327 Bytes

Contents

# frozen_string_literal: true

class MigrateTemplatable < ActiveRecord::Migration[6.0]
  def self.up
    Decidim::Templates::Template.find_each do |template|
      next if template.target.present?

      template.update(target: template.templatable_type.demodulize.tableize.singularize)
    end
  end

  def self.down; end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
decidim-reporting_proposals-0.5.2 db/migrate/20230404104741_migrate_templatable.rb
decidim-reporting_proposals-0.5.1 db/migrate/20230404104741_migrate_templatable.rb
decidim-reporting_proposals-0.5.0 db/migrate/20230404104741_migrate_templatable.rb
decidim-reporting_proposals-0.4.2 db/migrate/20230404104741_migrate_templatable.rb