Sha256: bd40ad87c943dcd494e2243f95170461b38b159371b7234705f4158c496bde35
Contents?: true
Size: 355 Bytes
Versions: 6
Compression:
Stored size: 355 Bytes
Contents
class AddBlogIdToRedirects < ActiveRecord::Migration 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
6 entries across 6 versions & 1 rubygems