mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user