Skip to content

Commit c82fd1f

Browse files
committed
Fix data insertion in NewThreadFollower migration
1 parent ac4f738 commit c82fd1f

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

db/migrate/20251203164131_create_new_thread_followers.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ def create_table_new_thread_followers
1717

1818
def move_rows_with_non_nil_post_id
1919
NewThreadFollower.insert_all(
20-
ThreadFollower.select(:user_id, :post_id, :created_at, :updated_at).where.not(post_id:nil)
20+
ThreadFollower.select(:user_id, :post_id, :created_at, :updated_at)
21+
.where.not(post_id:nil)
22+
.to_a
23+
.map(&:attributes)
2124
)
2225
ThreadFollower.where.not(post_id:nil).delete_all
2326
end

0 commit comments

Comments
 (0)