Sha256: b0757901f638801a6f35e1e7e71267bfe3b19452b716bfe9a552b8e558bdcd6e

Contents?: true

Size: 635 Bytes

Versions: 64

Compression:

Stored size: 635 Bytes

Contents

# frozen_string_literal: true

class AddVersionToActionLogs < ActiveRecord::Migration[5.1]
  class ActionLog < ApplicationRecord
    self.table_name = :decidim_action_logs
  end

  def up
    add_column :decidim_action_logs, :version_id, :integer, index: true

    ActionLog.find_each do |action_log|
      version_id = action_log.extra.dig("version", "id")
      next unless version_id

      # rubocop:disable Rails/SkipsModelValidations
      action_log.update_column(:version_id, version_id)
      # rubocop:enable Rails/SkipsModelValidations
    end
  end

  def down
    remove_column :decidim_action_logs, :version_id
  end
end

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
decidim-core-0.29.1 db/migrate/20180226140756_add_version_to_action_logs.rb
decidim-core-0.28.4 db/migrate/20180226140756_add_version_to_action_logs.rb
decidim-core-0.27.9 db/migrate/20180226140756_add_version_to_action_logs.rb
decidim-core-0.29.0 db/migrate/20180226140756_add_version_to_action_logs.rb
decidim-core-0.28.3 db/migrate/20180226140756_add_version_to_action_logs.rb
decidim-core-0.27.8 db/migrate/20180226140756_add_version_to_action_logs.rb
decidim-core-0.29.0.rc4 db/migrate/20180226140756_add_version_to_action_logs.rb
decidim-core-0.29.0.rc3 db/migrate/20180226140756_add_version_to_action_logs.rb
decidim-core-0.29.0.rc2 db/migrate/20180226140756_add_version_to_action_logs.rb
decidim-core-0.29.0.rc1 db/migrate/20180226140756_add_version_to_action_logs.rb
decidim-core-0.28.2 db/migrate/20180226140756_add_version_to_action_logs.rb
decidim-core-0.27.7 db/migrate/20180226140756_add_version_to_action_logs.rb
decidim-core-0.28.1 db/migrate/20180226140756_add_version_to_action_logs.rb
decidim-core-0.27.6 db/migrate/20180226140756_add_version_to_action_logs.rb
decidim-core-0.26.10 db/migrate/20180226140756_add_version_to_action_logs.rb
decidim-core-0.26.9 db/migrate/20180226140756_add_version_to_action_logs.rb
decidim-core-0.28.0 db/migrate/20180226140756_add_version_to_action_logs.rb
decidim-core-0.27.5 db/migrate/20180226140756_add_version_to_action_logs.rb
decidim-core-0.28.0.rc5 db/migrate/20180226140756_add_version_to_action_logs.rb
decidim-core-0.28.0.rc4 db/migrate/20180226140756_add_version_to_action_logs.rb