@@ -21,7 +21,10 @@ namespace :team do
21
21
right = mongo . send ( attr )
22
22
23
23
if left != right
24
- puts "#{ attr } | #{ left } != #{ right } | pg:#{ pg . id } | mongo:#{ mongo . id } "
24
+ puts "#{ attr } | pg:#{ pg . id } | mongo:#{ mongo . id } | #{ left } != #{ right } "
25
+ true
26
+ else
27
+ false
25
28
end
26
29
rescue => ex
27
30
puts '*' *80
@@ -42,8 +45,11 @@ namespace :team do
42
45
mongo_id = pg_team . mongo_id
43
46
mongo_team = Team . find ( mongo_id )
44
47
48
+ # Ignoring:
49
+ # - updated_at
50
+
45
51
# Team
46
- %i( updated_at median score total slug mean pending_join_requests ) . each do |attr |
52
+ %i( median score total slug mean pending_join_requests ) . each do |attr |
47
53
neq ( attr , pg_team , mongo_team , false )
48
54
end
49
55
@@ -52,14 +58,26 @@ namespace :team do
52
58
end
53
59
54
60
# TODO: Account
55
- unless mongo_team . account . nil? || pg_team . account . nil?
56
- %i( stripe_card_token stripe_customer_token admin_id ) . each do |attr |
61
+ if mongo_team . account . present? && pg_team . account . blank?
62
+ puts "account | pg:#{ pg_team . id } | mongo:#{ mongo_team . id } | The account was not migrated."
63
+ end
64
+
65
+ if mongo_team . account . present? && pg_team . account . present?
66
+ check_plans = %i( stripe_card_token stripe_customer_token admin_id ) . map do |attr |
57
67
neq ( attr , pg_team . account , mongo_team . account )
68
+ end . any? { |x | !x }
69
+
70
+ # TODO: Plans
71
+ if check_plans
72
+ left = pg_team . account . plans . pluck ( :id ) . sort
73
+ right = mongo_team . account . plan_ids . sort
74
+
75
+ if left != right
76
+ puts "account.plans | pg:#{ pg_team . id } | mongo:#{ mongo_team . id } | #{ left } != #{ right } "
77
+ end
58
78
end
59
79
end
60
80
61
- # TODO: Plans
62
-
63
81
# TODO: Locations
64
82
65
83
# TODO: Links
0 commit comments