Skip to content

Commit b57e83f

Browse files
committed
record comments not migrated
1 parent 94f16e2 commit b57e83f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/tasks/db.rake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,21 @@ namespace :db do
100100

101101
task :comments => :connect do
102102
Comment.reset_pk_sequence
103+
not_ported = []
103104
Legacy[:comments].where(port_data_since).each do |row|
104105
if row[:comment].to_s.size >= 2
105106
comment = Comment.find_or_initialize_by_id(row[:id])
106107
comment.attributes.except(:comment).keys.each do |key|
107108
comment[key] = row[key.to_sym]
108109
end
109110
comment.body = row[:comment]
110-
comment.save!
111+
if !comment.save
112+
not_ported << comment
113+
end
111114
end
112115
end
113116
Comment.reset_pk_sequence
117+
puts "Failed to port #{not_ported.size}"
114118
end
115119

116120
task :teams => :connect do

0 commit comments

Comments
 (0)