@@ -5,7 +5,6 @@ Coderwall::Application.load_tasks
5
5
6
6
task default : :spec
7
7
8
-
9
8
namespace :team do
10
9
task migrate : :environment do
11
10
puts '--- Beginning team migration ---'
@@ -30,58 +29,11 @@ namespace :team do
30
29
# IMPORTANT: pending_join_requests is an array of User#id values
31
30
#
32
31
33
- def neq ( attr , pg , mongo , fail_if_neq = true )
34
- left = pg . send ( attr )
35
- right = mongo . send ( attr )
36
-
37
- if left != right
38
- puts "#{ attr } | pg:#{ pg . id } | mongo:#{ mongo . id } | #{ left } != #{ right } "
39
- true
40
- else
41
- false
42
- end
43
- rescue => ex
44
- puts '*' *80
45
- puts
46
- puts ex
47
- puts
48
- puts '-' *80
49
- puts
50
- ap ex . backtrace
51
- puts
52
- puts '*' *80
53
-
54
- require 'pry' ; binding . pry
55
- end
56
-
57
- def neq_dec ( attr , pg , mongo , fail_if_neq = true )
58
- scale = 7
59
-
60
- left = pg . send ( attr ) . to_d . round ( scale )
61
- right = mongo . send ( attr ) . to_d . round ( scale )
62
-
63
-
64
- if left != right
65
- puts "#{ attr } | pg:#{ pg . id } | mongo:#{ mongo . id } | #{ left } != #{ right } "
66
- true
67
- else
68
- false
69
- end
70
- rescue => ex
71
- puts '*' *80
72
- puts
73
- puts ex
74
- puts
75
- puts '-' *80
76
- puts
77
- ap ex . backtrace
78
- puts
79
- puts '*' *80
80
-
81
- require 'pry' ; binding . pry
82
- end
83
-
84
32
task verify : :environment do
33
+ ActiveRecord ::Base . logger = nil
34
+ Mongoid . logger = nil
35
+ Moped . logger = nil
36
+
85
37
PgTeam . find_each ( batch_size : 100 ) do |pg_team |
86
38
begin
87
39
mongo_id = pg_team . mongo_id
@@ -263,12 +215,56 @@ namespace :team do
263
215
end
264
216
end
265
217
266
-
267
218
# TODO: Pending Requests
268
219
end
269
220
end
270
221
end
271
222
223
+ def neq ( attr , pg , mongo , fail_if_neq = true )
224
+ left = pg . send ( attr )
225
+ right = mongo . send ( attr )
226
+
227
+ if left != right
228
+ puts "#{ attr } | pg:#{ pg . id } | mongo:#{ mongo . id } | #{ left } != #{ right } "
229
+ true
230
+ else
231
+ false
232
+ end
233
+ rescue => ex
234
+ print_neq_error ( ex )
235
+ end
236
+
237
+ def neq_dec ( attr , pg , mongo , fail_if_neq = true )
238
+ scale = 7
239
+
240
+ left = pg . send ( attr ) . to_d . round ( scale )
241
+ right = mongo . send ( attr ) . to_d . round ( scale )
242
+
243
+
244
+ if left != right
245
+ puts "#{ attr } | pg:#{ pg . id } | mongo:#{ mongo . id } | #{ left } != #{ right } "
246
+ true
247
+ else
248
+ false
249
+ end
250
+ rescue => ex
251
+ print_neq_error ( ex )
252
+ end
253
+
254
+ def print_neq_error ( ex )
255
+ puts '*' *80
256
+ puts
257
+ puts ex
258
+ puts
259
+ puts '-' *80
260
+ puts
261
+ ap ex . backtrace
262
+ puts
263
+ puts '*' *80
264
+
265
+ require 'pry' ; binding . pry
266
+ end
267
+
272
268
task counts : :environment do
273
269
pg_team_count = PgTeam . count
274
270
puts "PgTeam.count=#{ pg_team_count } "
0 commit comments