myreplicator 1.1.25 → 1.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -123,7 +123,7 @@ module Myreplicator
|
|
123
123
|
:filepath => filepath,
|
124
124
|
:destination_schema => @export_obj.destination_schema}
|
125
125
|
|
126
|
-
schema_status = MysqlExporter.schema_changed?(options)
|
126
|
+
schema_status = Myreplicator::MysqlExporter.schema_changed?(options)
|
127
127
|
Kernel.p "===== schema_status ====="
|
128
128
|
Kernel.p schema_status
|
129
129
|
if schema_status[:changed] # && new?
|
@@ -162,11 +162,13 @@ module Myreplicator
|
|
162
162
|
while index < vertica_schema.size
|
163
163
|
# check for column name
|
164
164
|
if vertica_schema.rows[index][:column_name] != mysql_schema[index]["column_name"]
|
165
|
+
puts "diff"
|
165
166
|
return true
|
166
167
|
end
|
167
168
|
|
168
169
|
# check for column's data type
|
169
170
|
if compare_datatypes index, vertica_schema, mysql_schema
|
171
|
+
puts "diff #{index}"
|
170
172
|
return true
|
171
173
|
end
|
172
174
|
# and others ?? (PRIMARY, DEFAULT NULL, etc.)
|
@@ -178,7 +180,7 @@ module Myreplicator
|
|
178
180
|
|
179
181
|
def self.compare_datatypes index, vertica_schema, mysql_schema
|
180
182
|
type = Myreplicator::VerticaTypes.convert mysql_schema[index]["data_type"], mysql_schema[index]["column_type"]
|
181
|
-
if vertica_schema.rows[index][:data_type] != type
|
183
|
+
if vertica_schema.rows[index][:data_type].downcase != type.downcase
|
182
184
|
if vertica_schema.rows[index][:data_type] != "timestamp"
|
183
185
|
return true
|
184
186
|
end
|
data/lib/loader/vertica/types.rb
CHANGED
@@ -385,6 +385,28 @@ module Myreplicator
|
|
385
385
|
# place holder
|
386
386
|
end
|
387
387
|
end
|
388
|
+
|
389
|
+
def clean_up_temp_tables db
|
390
|
+
sql = "SELECT table_name FROm v_catalog.tables WHERE table_schema ='#{db}' and table_name LIKE 'temp_%';"
|
391
|
+
result = Myreplicator::DB.exec_sql("vertica",sql)
|
392
|
+
result.rows.each do |row|
|
393
|
+
tb = row[:table_name]
|
394
|
+
|
395
|
+
if tb.size > 15
|
396
|
+
time_str = tb[(tb.size-15)..(tb.size-1)]
|
397
|
+
begin
|
398
|
+
time = Time.local(time_str[0..3], time_str[4..5], time_str[6..7], time_str[9..10], time_str[11..12], time_str[13..14])
|
399
|
+
rescue Exception => e
|
400
|
+
puts e.message
|
401
|
+
next
|
402
|
+
end
|
403
|
+
if time < Time.now() - 1.day
|
404
|
+
sql = "DROP TABLE IF EXISTS #{db}.#{tb} CASCADE;"
|
405
|
+
Myreplicator::DB.exec_sql("vertica",sql)
|
406
|
+
end
|
407
|
+
end
|
408
|
+
end
|
409
|
+
end
|
388
410
|
=begin
|
389
411
|
def create_all_tables db
|
390
412
|
tables = Myreplicator::DB.get_tables(db)
|
data/lib/myreplicator/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: myreplicator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.26
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -359,7 +359,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
359
359
|
version: '0'
|
360
360
|
segments:
|
361
361
|
- 0
|
362
|
-
hash:
|
362
|
+
hash: 2980542232773579979
|
363
363
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
364
364
|
none: false
|
365
365
|
requirements:
|
@@ -368,7 +368,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
368
368
|
version: '0'
|
369
369
|
segments:
|
370
370
|
- 0
|
371
|
-
hash:
|
371
|
+
hash: 2980542232773579979
|
372
372
|
requirements: []
|
373
373
|
rubyforge_project:
|
374
374
|
rubygems_version: 1.8.24
|