Sha256: 86c01896fac2c096257685415ddd3c111e111d4aeb4075044fa372281cceee8b

Contents?: true

Size: 656 Bytes

Versions: 1

Compression:

Stored size: 656 Bytes

Contents

class RemoveImageIdAndExternalUrlFromNews < ActiveRecord::Migration
  def self.up
    if ::NewsItem.column_names.map(&:to_sym).include?(:external_url)
      remove_column ::NewsItem.table_name, :external_url
    end
    if ::NewsItem.column_names.map(&:to_sym).include?(:image_id)
      remove_column ::NewsItem.table_name, :image_id
    end
  end

  def self.down
    unless ::NewsItem.column_names.map(&:to_sym).include?(:external_url)
      add_column ::NewsItem.table_name, :external_url, :string
    end
    unless ::NewsItem.column_names.map(&:to_sym).include?(:image_id)
      add_column ::NewsItem.table_name, :image_id, :integer
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
refinerycms-news-1.2.0 db/migrate/6_remove_image_id_and_external_url_from_news.rb