mongify 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.rdoc +5 -0
- data/Gemfile.lock +16 -16
- data/lib/mongify/database/column.rb +3 -4
- data/lib/mongify/progressbar.rb +2 -2
- data/lib/mongify/translation/processor_common.rb +45 -43
- data/lib/mongify/version.rb +1 -1
- data/mongify.gemspec +2 -2
- data/spec/mongify/translation/process_spec.rb +17 -25
- metadata +46 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee3d1cab396b3d4447aaa0a3c554fb099ba5d220
|
4
|
+
data.tar.gz: 5edb578b04784f5802d2c2808bc15f99b1210b1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26c11f96a3f9b43ec9c5cf7ace0e426888518668d28811af21e59f53305bfbb8b7f733f145ab8e316e7a9ee375a3fd7556d371ea7912b4ead3ae7f1b7fb7d135
|
7
|
+
data.tar.gz: 4ab3eebe201846ddcf3da0000d2581467bb84bcfbfc0824a2b121c35b6039b670e426d60319e5ffa531bfbe41dcebc71429087773b7a7279065eef56ee2121c3
|
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
== 1.2 / Development
|
2
|
+
* Added batching to embedded and polymorphic tables.
|
3
|
+
* Tweaked progress bar display.
|
4
|
+
* Fixed issue with embedding
|
5
|
+
* Updated mongo drivers to version 1.10.2
|
1
6
|
== 1.1 / 24 March 2014
|
2
7
|
* Sync feature add (thanks to {hammady}[https://github.com/hammady])
|
3
8
|
* Parent unset in before_save (tanks to {nessche}[https://github.com/nessche])
|
data/Gemfile.lock
CHANGED
@@ -1,34 +1,34 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
mongify (1.
|
4
|
+
mongify (1.2.0)
|
5
5
|
activerecord (~> 3.2)
|
6
6
|
activesupport (~> 3.2)
|
7
|
-
bson_ext (~> 1.
|
7
|
+
bson_ext (~> 1.10.2)
|
8
8
|
highline (>= 1.6.1)
|
9
|
-
mongo (~> 1.
|
9
|
+
mongo (~> 1.10.2)
|
10
10
|
|
11
11
|
GEM
|
12
12
|
remote: http://rubygems.org/
|
13
13
|
specs:
|
14
|
-
activemodel (3.2.
|
15
|
-
activesupport (= 3.2.
|
14
|
+
activemodel (3.2.18)
|
15
|
+
activesupport (= 3.2.18)
|
16
16
|
builder (~> 3.0.0)
|
17
|
-
activerecord (3.2.
|
18
|
-
activemodel (= 3.2.
|
19
|
-
activesupport (= 3.2.
|
17
|
+
activerecord (3.2.18)
|
18
|
+
activemodel (= 3.2.18)
|
19
|
+
activesupport (= 3.2.18)
|
20
20
|
arel (~> 3.0.2)
|
21
21
|
tzinfo (~> 0.3.29)
|
22
|
-
activesupport (3.2.
|
22
|
+
activesupport (3.2.18)
|
23
23
|
i18n (~> 0.6, >= 0.6.4)
|
24
24
|
multi_json (~> 1.0)
|
25
25
|
arel (3.0.3)
|
26
26
|
binding_of_caller (0.7.2)
|
27
27
|
debug_inspector (>= 0.0.1)
|
28
28
|
bond (0.5.1)
|
29
|
-
bson (1.
|
30
|
-
bson_ext (1.
|
31
|
-
bson (~> 1.
|
29
|
+
bson (1.10.2)
|
30
|
+
bson_ext (1.10.2)
|
31
|
+
bson (~> 1.10.2)
|
32
32
|
builder (3.0.4)
|
33
33
|
coderay (1.1.0)
|
34
34
|
columnize (0.3.6)
|
@@ -48,7 +48,7 @@ GEM
|
|
48
48
|
diff-lcs (1.2.5)
|
49
49
|
gherkin (2.12.2)
|
50
50
|
multi_json (~> 1.3)
|
51
|
-
highline (1.6.
|
51
|
+
highline (1.6.21)
|
52
52
|
i18n (0.6.9)
|
53
53
|
interception (0.5)
|
54
54
|
jist (1.5.1)
|
@@ -58,8 +58,8 @@ GEM
|
|
58
58
|
method_source (0.8.2)
|
59
59
|
mocha (0.14.0)
|
60
60
|
metaclass (~> 0.0.1)
|
61
|
-
mongo (1.
|
62
|
-
bson (
|
61
|
+
mongo (1.10.2)
|
62
|
+
bson (= 1.10.2)
|
63
63
|
multi_json (1.8.2)
|
64
64
|
multi_test (0.0.2)
|
65
65
|
mysql2 (0.3.15)
|
@@ -102,7 +102,7 @@ GEM
|
|
102
102
|
rspec-mocks (2.14.4)
|
103
103
|
slop (3.5.0)
|
104
104
|
sqlite3 (1.3.8)
|
105
|
-
tzinfo (0.3.
|
105
|
+
tzinfo (0.3.39)
|
106
106
|
watchr (0.7)
|
107
107
|
yard (0.8.7.3)
|
108
108
|
|
@@ -226,9 +226,6 @@ module Mongify
|
|
226
226
|
def scale=(value)
|
227
227
|
options['scale'] = value.to_i
|
228
228
|
end
|
229
|
-
#######
|
230
|
-
private
|
231
|
-
#######
|
232
229
|
|
233
230
|
# Casts the value to a given type
|
234
231
|
def type_cast(value)
|
@@ -256,7 +253,9 @@ module Mongify
|
|
256
253
|
end
|
257
254
|
end
|
258
255
|
|
259
|
-
|
256
|
+
#######
|
257
|
+
private
|
258
|
+
#######
|
260
259
|
|
261
260
|
# runs auto detect (see {Mongify::Database::Column.auto_detect})
|
262
261
|
def run_auto_detect!
|
data/lib/mongify/progressbar.rb
CHANGED
@@ -30,7 +30,7 @@ module Mongify
|
|
30
30
|
@finished_p = false
|
31
31
|
@start_time = Time.now
|
32
32
|
@previous_time = @start_time
|
33
|
-
@title_width =
|
33
|
+
@title_width = 37
|
34
34
|
@format = "%-#{@title_width}s %s %3d%% %s %s"
|
35
35
|
@format_arguments = [:title, :count, :percentage, :bar, :stat]
|
36
36
|
clear
|
@@ -79,7 +79,7 @@ module Mongify
|
|
79
79
|
|
80
80
|
# Formatting for count (x/y)
|
81
81
|
def fmt_count
|
82
|
-
sprintf('%
|
82
|
+
sprintf('%13s', "(#{@current}/#{@total})")
|
83
83
|
end
|
84
84
|
|
85
85
|
# Converts bytes to kb, mb or gb
|
@@ -34,24 +34,26 @@ module Mongify
|
|
34
34
|
# Does a copy of the embedded tables
|
35
35
|
def copy_embedded_tables
|
36
36
|
self.embed_tables.each do |t|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
37
|
+
sql_connection.select_rows(t.sql_name) do |rows, page, total_pages|
|
38
|
+
Mongify::Status.publish('copy_embedded', :size => rows.count, :name => "Embedding #{t.name} (#{page}/#{total_pages})", :action => 'add')
|
39
|
+
rows.each do |row|
|
40
|
+
target_row_id = t.find_column(t.embed_on).try(:type_cast, row[t.embed_on]) || row[t.embed_on]
|
41
|
+
target_row = no_sql_connection.find_one(t.embed_in, {:pre_mongified_id => target_row_id})
|
42
|
+
next unless target_row.present?
|
43
|
+
row, parent_row, unset_keys = t.translate(row, target_row)
|
44
|
+
parent_row ||= {}
|
45
|
+
parent_row.delete("_id")
|
46
|
+
parent_row.delete(t.name.to_s)
|
47
|
+
unset_keys ||= {}
|
48
|
+
row.delete(t.embed_on)
|
49
|
+
row.merge!(fetch_reference_ids(t, row))
|
50
|
+
row.delete('pre_mongified_id')
|
51
|
+
save_function_call = t.embedded_as_object? ? '$set' : '$addToSet'
|
52
|
+
no_sql_connection.update(t.embed_in, target_row['_id'], append_parent_object({save_function_call => {t.name => row}}, parent_row, unset_keys))
|
53
|
+
Mongify::Status.publish('copy_embedded')
|
54
|
+
end
|
55
|
+
Mongify::Status.publish('copy_embedded', :action => 'finish')
|
53
56
|
end
|
54
|
-
Mongify::Status.publish('copy_embedded', :action => 'finish')
|
55
57
|
end
|
56
58
|
end
|
57
59
|
|
@@ -59,34 +61,34 @@ module Mongify
|
|
59
61
|
def copy_polymorphic_tables
|
60
62
|
self.polymorphic_tables.each do |t|
|
61
63
|
polymorphic_id_col, polymorphic_type_col = "#{t.polymorphic_as}_id", "#{t.polymorphic_as}_type"
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
64
|
+
sql_connection.select_rows(t.sql_name) do |rows, page, total_pages|
|
65
|
+
Mongify::Status.publish('copy_polymorphic', :size => rows.count, :name => "Polymorphicizing #{t.name}", :action => 'add')
|
66
|
+
rows.each do |row|
|
67
|
+
|
68
|
+
#If no data is in the column, skip importing
|
69
|
+
if (row[polymorphic_type_col])
|
70
|
+
table_name = row[polymorphic_type_col].tableize
|
71
|
+
new_id = no_sql_connection.get_id_using_pre_mongified_id(table_name, row[polymorphic_id_col])
|
72
|
+
end
|
73
|
+
|
74
|
+
row = t.translate(row)
|
75
|
+
row[polymorphic_id_col] = new_id if new_id
|
76
|
+
row.merge!(fetch_reference_ids(t, row))
|
77
|
+
row.delete('pre_mongified_id')
|
78
|
+
|
79
|
+
if t.embedded? && table_name
|
80
|
+
row.delete(polymorphic_id_col)
|
81
|
+
row.delete(polymorphic_type_col)
|
82
|
+
save_function_call = t.embedded_as_object? ? '$set' : '$addToSet'
|
83
|
+
no_sql_connection.update(table_name, new_id, {save_function_call => {t.name => row}})
|
84
|
+
else
|
85
|
+
no_sql_connection.insert_into(t.name, row)
|
86
|
+
end
|
87
|
+
|
88
|
+
Mongify::Status.publish('copy_polymorphic')
|
71
89
|
end
|
72
|
-
|
73
|
-
row = t.translate(row)
|
74
|
-
row[polymorphic_id_col] = new_id if new_id
|
75
|
-
row.merge!(fetch_reference_ids(t, row))
|
76
|
-
row.delete('pre_mongified_id')
|
77
|
-
|
78
|
-
if t.embedded? && table_name
|
79
|
-
row.delete(polymorphic_id_col)
|
80
|
-
row.delete(polymorphic_type_col)
|
81
|
-
save_function_call = t.embedded_as_object? ? '$set' : '$addToSet'
|
82
|
-
no_sql_connection.update(table_name, new_id, {save_function_call => {t.name => row}})
|
83
|
-
else
|
84
|
-
no_sql_connection.insert_into(t.name, row)
|
85
|
-
end
|
86
|
-
|
87
|
-
Mongify::Status.publish('copy_polymorphic')
|
90
|
+
Mongify::Status.publish('copy_polymorphic', :action => 'finish')
|
88
91
|
end
|
89
|
-
Mongify::Status.publish('copy_polymorphic', :action => 'finish')
|
90
92
|
end
|
91
93
|
end
|
92
94
|
|
data/lib/mongify/version.rb
CHANGED
data/mongify.gemspec
CHANGED
@@ -14,8 +14,8 @@ Gem::Specification.new do |s|
|
|
14
14
|
|
15
15
|
s.add_dependency('activerecord', "~> 3.2")
|
16
16
|
s.add_dependency('activesupport', "~> 3.2")
|
17
|
-
s.add_dependency('mongo', "~> 1.
|
18
|
-
s.add_dependency('bson_ext', "~> 1.
|
17
|
+
s.add_dependency('mongo', "~> 1.10.2")
|
18
|
+
s.add_dependency('bson_ext', "~> 1.10.2") unless RUBY_PLATFORM == 'java'
|
19
19
|
s.add_dependency('highline', '>= 1.6.1')
|
20
20
|
|
21
21
|
|
@@ -63,7 +63,7 @@ describe Mongify::Translation::Process do
|
|
63
63
|
it "should get correct information" do
|
64
64
|
@no_sql_connection = mock()
|
65
65
|
@translation.stub(:no_sql_connection).and_return(@no_sql_connection)
|
66
|
-
@table = mock(:translate => {}, :name => 'users', :embedded? => false)
|
66
|
+
@table = mock(:translate => {}, :name => 'users', :embedded? => false, :find_column => nil)
|
67
67
|
@column = mock(:name => 'user_id', :references => 'users')
|
68
68
|
@table.stub(:reference_columns).and_return([@column])
|
69
69
|
@no_sql_connection.should_receive(:get_id_using_pre_mongified_id).with('users', 1).once.and_return(500)
|
@@ -112,9 +112,9 @@ describe Mongify::Translation::Process do
|
|
112
112
|
|
113
113
|
context "copy_embed_tables" do
|
114
114
|
before(:each) do
|
115
|
-
@sql_connection.stub(:
|
115
|
+
@sql_connection.stub(:select_paged_rows).and_return([{'first_name'=> 'Timmy', 'last_name' => 'Zuza', 'preference_id' => 1}])
|
116
116
|
@target_table = mock(:name => 'posts', :embedded? => false, :sql_name => 'posts')
|
117
|
-
@embed_table = mock(:translate => {}, :name => 'comments', :embedded? => true, :embed_on => 'post_id', :embed_in => 'posts', :embedded_as_object? => false, :sql_name => 'comments')
|
117
|
+
@embed_table = mock(:translate => {}, :name => 'comments', :embedded? => true, :embed_on => 'post_id', :embed_in => 'posts', :embedded_as_object? => false, :sql_name => 'comments', :find_column => nil)
|
118
118
|
@no_sql_connection.stub(:find_one).and_return({'_id' => 500})
|
119
119
|
@translation.stub(:tables).and_return([@target_table, @embed_table])
|
120
120
|
@translation.stub(:fetch_reference_ids).and_return({})
|
@@ -126,25 +126,25 @@ describe Mongify::Translation::Process do
|
|
126
126
|
@translation.send(:copy_embedded_tables)
|
127
127
|
end
|
128
128
|
it "should remove the pre_mongified_id before embedding" do
|
129
|
-
@embed_table = mock(:translate => {'first_name' => 'bob', 'pre_mongified_id' => 1}, :name => 'comments', :sql_name => 'comments', :embedded? => true, :embed_on => 'post_id', :embed_in => 'posts', :embedded_as_object? => false)
|
129
|
+
@embed_table = mock(:translate => {'first_name' => 'bob', 'pre_mongified_id' => 1}, :name => 'comments', :sql_name => 'comments', :embedded? => true, :embed_on => 'post_id', :embed_in => 'posts', :embedded_as_object? => false, :find_column => nil)
|
130
130
|
@translation.stub(:tables).and_return([@target_table, @embed_table])
|
131
131
|
@no_sql_connection.should_receive(:update).with("posts", 500, {"$addToSet"=>{"comments"=>{'first_name' => 'bob'}}})
|
132
132
|
@translation.send(:copy_embedded_tables)
|
133
133
|
end
|
134
134
|
it "should remove the parent_id from the embedding row" do
|
135
|
-
@embed_table = mock(:translate => {'first_name' => 'bob', 'post_id' => 1}, :name => 'comments', :sql_name => 'comments', :embedded? => true, :embed_on => 'post_id', :embed_in => 'posts', :embedded_as_object? => false)
|
135
|
+
@embed_table = mock(:translate => {'first_name' => 'bob', 'post_id' => 1}, :name => 'comments', :sql_name => 'comments', :embedded? => true, :embed_on => 'post_id', :embed_in => 'posts', :embedded_as_object? => false, :find_column => nil)
|
136
136
|
@translation.stub(:tables).and_return([@target_table, @embed_table])
|
137
137
|
@no_sql_connection.should_receive(:update).with("posts", 500, {"$addToSet"=>{"comments"=>{'first_name' => 'bob'}}})
|
138
138
|
@translation.send(:copy_embedded_tables)
|
139
139
|
end
|
140
140
|
it "should call $addToSet on update of an embed_as_object table" do
|
141
|
-
@embed_table = mock(:translate => {'first_name' => 'bob', 'post_id' => 1}, :name => 'comments', :sql_name => 'comments', :embedded? => true, :embed_on => 'post_id', :embed_in => 'posts', :embedded_as_object? => true)
|
141
|
+
@embed_table = mock(:translate => {'first_name' => 'bob', 'post_id' => 1}, :name => 'comments', :sql_name => 'comments', :embedded? => true, :embed_on => 'post_id', :embed_in => 'posts', :embedded_as_object? => true, :find_column => nil)
|
142
142
|
@translation.stub(:tables).and_return([@target_table, @embed_table])
|
143
143
|
@no_sql_connection.should_receive(:update).with("posts", 500, {"$set"=>{"comments"=>{'first_name' => 'bob'}}})
|
144
144
|
@translation.send(:copy_embedded_tables)
|
145
145
|
end
|
146
146
|
it "should allow rename of table" do
|
147
|
-
@embed_table = mock(:translate => {'first_name' => 'bob', 'post_id' => 1}, :name => 'notes', :sql_name => 'comments', :embedded? => true, :embed_on => 'post_id', :embed_in => 'posts', :embedded_as_object? => true)
|
147
|
+
@embed_table = mock(:translate => {'first_name' => 'bob', 'post_id' => 1}, :name => 'notes', :sql_name => 'comments', :embedded? => true, :embed_on => 'post_id', :embed_in => 'posts', :embedded_as_object? => true, :find_column => nil)
|
148
148
|
@translation.stub(:tables).and_return([@target_table, @embed_table])
|
149
149
|
@no_sql_connection.should_receive(:update).with("posts", 500, {"$set"=>{"notes"=>{'first_name' => 'bob'}}})
|
150
150
|
@translation.send(:copy_embedded_tables)
|
@@ -152,25 +152,25 @@ describe Mongify::Translation::Process do
|
|
152
152
|
|
153
153
|
context "parent modification" do
|
154
154
|
it 'should unset fields deleted in the parent row' do
|
155
|
-
@embed_table = mock(:translate => [{}, {'email' => 'true'}, {'field_1' => '1'}], :name => 'preferences', :sql_name => 'preferences', :embedded? => true, :embed_on => 'post_id', :embed_in => 'posts', :embedded_as_object? => true)
|
155
|
+
@embed_table = mock(:translate => [{}, {'email' => 'true'}, {'field_1' => '1'}], :name => 'preferences', :sql_name => 'preferences', :embedded? => true, :embed_on => 'post_id', :embed_in => 'posts', :embedded_as_object? => true, :find_column => nil)
|
156
156
|
@translation.stub(:tables).and_return([@target_table, @embed_table])
|
157
157
|
@no_sql_connection.should_receive(:update).with("posts", 500, {"$set"=>{"preferences"=>{}, "email"=>"true"}, "$unset"=>{'field_1' => '1'}})
|
158
158
|
@translation.send(:copy_embedded_tables)
|
159
159
|
end
|
160
160
|
it "should work with embedded objects" do
|
161
|
-
@embed_table = mock(:translate => [{}, {'email' => 'true'}, {}], :name => 'preferences', :sql_name => 'preferences', :embedded? => true, :embed_on => 'post_id', :embed_in => 'posts', :embedded_as_object? => true)
|
161
|
+
@embed_table = mock(:translate => [{}, {'email' => 'true'}, {}], :name => 'preferences', :sql_name => 'preferences', :embedded? => true, :embed_on => 'post_id', :embed_in => 'posts', :embedded_as_object? => true, :find_column => nil)
|
162
162
|
@translation.stub(:tables).and_return([@target_table, @embed_table])
|
163
163
|
@no_sql_connection.should_receive(:update).with("posts", 500, {"$set"=>{"preferences"=>{}, "email"=>"true"}})
|
164
164
|
@translation.send(:copy_embedded_tables)
|
165
165
|
end
|
166
166
|
it "should work with embedded arrays" do
|
167
|
-
@embed_table = mock(:translate => [{}, {'email' => 'true'}, {}], :name => 'preferences', :sql_name => 'preferences', :embedded? => true, :embed_on => 'post_id', :embed_in => 'posts', :embedded_as_object? => false)
|
167
|
+
@embed_table = mock(:translate => [{}, {'email' => 'true'}, {}], :name => 'preferences', :sql_name => 'preferences', :embedded? => true, :embed_on => 'post_id', :embed_in => 'posts', :embedded_as_object? => false, :find_column => nil)
|
168
168
|
@translation.stub(:tables).and_return([@target_table, @embed_table])
|
169
169
|
@no_sql_connection.should_receive(:update).with("posts", 500, {"$addToSet"=>{"preferences"=>{}}, "$set" => {"email"=>"true"}})
|
170
170
|
@translation.send(:copy_embedded_tables)
|
171
171
|
end
|
172
172
|
it "should not set embedded attribute in parent" do
|
173
|
-
@embed_table = mock(:translate => [{'first_name' => 'joe'}, {'email' => 'true', 'comments' => [{'first_name' => 'bob'}]}, {}], :name => 'comments', :sql_name => 'comments', :embedded? => true, :embed_on => 'post_id', :embed_in => 'posts', :embedded_as_object? => false)
|
173
|
+
@embed_table = mock(:translate => [{'first_name' => 'joe'}, {'email' => 'true', 'comments' => [{'first_name' => 'bob'}]}, {}], :name => 'comments', :sql_name => 'comments', :embedded? => true, :embed_on => 'post_id', :embed_in => 'posts', :embedded_as_object? => false, :find_column => nil)
|
174
174
|
@translation.stub(:tables).and_return([@target_table, @embed_table])
|
175
175
|
@no_sql_connection.should_receive(:update).with("posts", 500, {"$addToSet" => {"comments" => {"first_name" => "joe"}}, "$set" => {"email" => "true"}})
|
176
176
|
@translation.send(:copy_embedded_tables)
|
@@ -231,7 +231,7 @@ describe Mongify::Translation::Process do
|
|
231
231
|
:sql_name => 'user_accounts')
|
232
232
|
@translation.stub(:find).with('user_accounts').and_return([@ref_table])
|
233
233
|
|
234
|
-
@sql_connection.stub(:
|
234
|
+
@sql_connection.stub(:select_paged_rows).with('comments', anything, anything).and_return([{'commentable_id' => 1, 'commentable_type' => 'UserAccount', 'data' => 'good'}])
|
235
235
|
@no_sql_connection.stub(:get_id_using_pre_mongified_id).with('user_accounts', 1).and_return(500)
|
236
236
|
end
|
237
237
|
context "embedded" do
|
@@ -253,7 +253,7 @@ describe Mongify::Translation::Process do
|
|
253
253
|
end
|
254
254
|
end
|
255
255
|
context "not embedded" do
|
256
|
-
|
256
|
+
before(:each) do
|
257
257
|
@table = mock(:translate => {'data' => 123, 'commentable_type' => 'UserAccount', 'commentable_id' => 1},
|
258
258
|
:name => 'comments',
|
259
259
|
:embedded? => false,
|
@@ -265,23 +265,15 @@ describe Mongify::Translation::Process do
|
|
265
265
|
:reference_columns => [])
|
266
266
|
|
267
267
|
@translation.stub(:all_tables).and_return([@table])
|
268
|
+
end
|
269
|
+
it "should work" do
|
268
270
|
@no_sql_connection.should_receive(:get_id_using_pre_mongified_id).with('user_accounts', 1).and_return(500)
|
269
271
|
@no_sql_connection.should_receive(:insert_into).with('comments', {'data' => 123, 'commentable_type' => 'UserAccount', 'commentable_id' => 500})
|
270
272
|
@translation.send(:copy_polymorphic_tables)
|
271
273
|
end
|
272
274
|
it "should copy even if there is no polymorphic data" do
|
273
|
-
@
|
274
|
-
|
275
|
-
:embedded? => false,
|
276
|
-
:polymorphic_as => 'commentable',
|
277
|
-
:polymorphic? => true,
|
278
|
-
:ignored? => false,
|
279
|
-
:embedded_as_object? => false,
|
280
|
-
:sql_name => 'comments',
|
281
|
-
:reference_columns => [])
|
282
|
-
|
283
|
-
@translation.stub(:all_tables).and_return([@table])
|
284
|
-
@sql_connection.should_receive(:select_rows).with('comments').and_return([{'commentable_id' => nil, 'commentable_type' => nil, 'data' => 'good'}])
|
275
|
+
@sql_connection.should_receive(:select_paged_rows).with('comments', anything, anything).and_return([{'commentable_id' => nil, 'commentable_type' => nil, 'data' => 'good'}])
|
276
|
+
@table.stub(:translate => {'data' => 123, 'commentable_type' => nil, 'commentable_id' => nil})
|
285
277
|
@no_sql_connection.should_receive(:insert_into).with('comments', {'data' => 123, 'commentable_type' => nil, 'commentable_id' => nil})
|
286
278
|
@no_sql_connection.should_receive(:get_id_using_pre_mongified_id).never
|
287
279
|
@translation.send(:copy_polymorphic_tables)
|
metadata
CHANGED
@@ -1,223 +1,223 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kalek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '3.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '3.2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '3.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: mongo
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.10.2
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 1.10.2
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bson_ext
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
61
|
+
version: 1.10.2
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.
|
68
|
+
version: 1.10.2
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: highline
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 1.6.1
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 1.6.1
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '2.0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '2.0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: cucumber
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0.10'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0.10'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: mocha
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: 0.9.8
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 0.9.8
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: yard
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: 0.5.3
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: 0.5.3
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: sqlite3
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- -
|
143
|
+
- - ">="
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '1.3'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- -
|
150
|
+
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '1.3'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: pg
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- -
|
157
|
+
- - ">="
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: '0.17'
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- -
|
164
|
+
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0.17'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: mysql2
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
|
-
- - ~>
|
171
|
+
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
173
|
version: 0.3.1
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
|
-
- - ~>
|
178
|
+
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: 0.3.1
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: watchr
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
|
-
- -
|
185
|
+
- - ">="
|
186
186
|
- !ruby/object:Gem::Version
|
187
187
|
version: '0.6'
|
188
188
|
type: :development
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
|
-
- -
|
192
|
+
- - ">="
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: '0.6'
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
196
|
name: rake
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
198
198
|
requirements:
|
199
|
-
- -
|
199
|
+
- - ">="
|
200
200
|
- !ruby/object:Gem::Version
|
201
201
|
version: '0'
|
202
202
|
type: :development
|
203
203
|
prerelease: false
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
|
-
- -
|
206
|
+
- - ">="
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: '0'
|
209
209
|
- !ruby/object:Gem::Dependency
|
210
210
|
name: pry-plus
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|
212
212
|
requirements:
|
213
|
-
- -
|
213
|
+
- - ">="
|
214
214
|
- !ruby/object:Gem::Version
|
215
215
|
version: '0'
|
216
216
|
type: :development
|
217
217
|
prerelease: false
|
218
218
|
version_requirements: !ruby/object:Gem::Requirement
|
219
219
|
requirements:
|
220
|
-
- -
|
220
|
+
- - ">="
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: '0'
|
223
223
|
description: Mongify allows you to map your sql data into a mongodb document database
|
@@ -231,9 +231,9 @@ extra_rdoc_files:
|
|
231
231
|
- CHANGELOG.rdoc
|
232
232
|
- README.rdoc
|
233
233
|
files:
|
234
|
-
- .gitignore
|
235
|
-
- .rspec
|
236
|
-
- .yardopts
|
234
|
+
- ".gitignore"
|
235
|
+
- ".rspec"
|
236
|
+
- ".yardopts"
|
237
237
|
- CHANGELOG.rdoc
|
238
238
|
- Gemfile
|
239
239
|
- Gemfile.lock
|
@@ -310,27 +310,27 @@ licenses: []
|
|
310
310
|
metadata: {}
|
311
311
|
post_install_message:
|
312
312
|
rdoc_options:
|
313
|
-
- --title
|
313
|
+
- "--title"
|
314
314
|
- Mongify -- SQL db to Mongo db converter
|
315
|
-
- --main
|
315
|
+
- "--main"
|
316
316
|
- README
|
317
|
-
- --line-numbers
|
318
|
-
- --inline-source
|
317
|
+
- "--line-numbers"
|
318
|
+
- "--inline-source"
|
319
319
|
require_paths:
|
320
320
|
- lib
|
321
321
|
required_ruby_version: !ruby/object:Gem::Requirement
|
322
322
|
requirements:
|
323
|
-
- -
|
323
|
+
- - ">="
|
324
324
|
- !ruby/object:Gem::Version
|
325
325
|
version: 1.8.7
|
326
326
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
327
327
|
requirements:
|
328
|
-
- -
|
328
|
+
- - ">="
|
329
329
|
- !ruby/object:Gem::Version
|
330
330
|
version: '0'
|
331
331
|
requirements: []
|
332
332
|
rubyforge_project:
|
333
|
-
rubygems_version: 2.0
|
333
|
+
rubygems_version: 2.3.0
|
334
334
|
signing_key:
|
335
335
|
specification_version: 4
|
336
336
|
summary: Translate your SQL data to MongoDB with ease
|