Class: Myreplicator::VerticaTypes

Inherits:
Object
  • Object
show all
Defined in:
lib/loader/vertica/types.rb

Class Method Summary collapse

Class Method Details

.convert(type, col_type) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/loader/vertica/types.rb', line 4

def self.convert type, col_type
  if mysql_vertica_conversion[type].blank?
    return col_type.gsub("decimal","numeric")
  else
    return mysql_vertica_conversion[type]
  end
end

.convert_key(key) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/loader/vertica/types.rb', line 31

def self.convert_key key
  map = {
    "UNI" => "UNIQUE",
  " MUL" => "", 
    "PRI" => "PRIMARY KEY"
  }

  if map[key].blank?
    return ""
  else
    return map[key]
  end
end

.mysql_vertica_conversionObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/loader/vertica/types.rb', line 12

def self.mysql_vertica_conversion
  map = {
    "int" => "int",
    "integer" => "int",
    "int8" => "int",
    "smallint" => "int",
    "bigint" => "int",
    "tinyint" => "int",
    "numeric" => "int",
    "text" => "VARCHAR(65000)",
    "mediumtext" => "VARCHAR(65000)",
    "bit" => "binary",
    "longtext" => "VARCHAR(65000)",
    "text" => "VARCHAR(65000)",
    "float" => "decimal",
    "double" => "double precision"
  }
end