Sha256: 61097ddf962a5bb5208344c59cec005e65401aa1b97e7954f8fca110b9864e7e
Contents?: true
Size: 418 Bytes
Versions: 10
Compression:
Stored size: 418 Bytes
Contents
# frozen_string_literal: true class AddBlogIdToRedirects < ActiveRecord::Migration[4.2] set_role "blog_content" class Redirect < ActiveRecord::Base; end def up add_column :redirects, :blog_id, :integer if Redirect.any? default_blog_id = Blog.order(:id).first.id Redirect.update_all("blog_id = #{default_blog_id}") end end def down remove_column :redirects, :blog_id end end
Version data entries
10 entries across 10 versions & 1 rubygems