Sha256: c7a1707c1264d1cb39d2df4ec2cb0e5bae127c598be9ebd2fb60d8f0db0cae1d
Contents?: true
Size: 685 Bytes
Versions: 10
Compression:
Stored size: 685 Bytes
Contents
class RemoveBlogIds < ActiveRecord::Migration def self.up remove_index :contents, :blog_id rescue nil remove_column :contents, :blog_id remove_column :sidebars, :blog_id remove_column :feedback, :blog_id end def self.down add_column :contents, :blog_id, :integer add_column :sidebars, :blog_id, :integer add_column :feedback, :blog_id, :integer default_blog_id = Blog.find(:first, :order => 'id').id Content.update_all("blog_id = #{default_blog_id}") Feedback.update_all("blog_id = #{default_blog_id}") Sidebar.update_all("blog_id = #{default_blog_id}") change_column :sidebars, :blog_id, :integer, :null => false end end
Version data entries
10 entries across 10 versions & 1 rubygems