Working out outdated migrations

Several migrations were failing when running db:migrate at the initial release version from an empty database.
These changes took out statements that were causing migrations to fail, usually because of references to models that no longer exist.
This commit is contained in:
Chris Schetter
2013-02-05 13:23:06 -08:00
parent 31c5859bbe
commit 32ff6c264a
7 changed files with 366 additions and 215 deletions

View File

@@ -3,14 +3,6 @@ class AddFeaturedToForumThreads < ActiveRecord::Migration
add_column :forum_threads, :featured_user1_id, :integer, null: true
add_column :forum_threads, :featured_user2_id, :integer, null: true
add_column :forum_threads, :featured_user3_id, :integer, null: true
# Migrate old threads
ForumThread.all.each do |forum_thread|
posts_count = Post.where(forum_thread_id: forum_thread.id).group(:user_id).order('count_all desc').limit(3).count
posts_count.keys.each_with_index {|user_id, i| forum_thread.send("featured_user#{i+1}_id=", user_id) }
forum_thread.save
end
end
def down