Sha256: 30317d2a4c304bad7604032696c628c597724b00b5f290a57a7436486ea8ebd2

Contents?: true

Size: 999 Bytes

Versions: 32

Compression:

Stored size: 999 Bytes

Contents

module Myreplicator
  class VerticaTypes
  
    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

    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

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

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

  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
myreplicator-1.1.73 lib/loader/vertica/types.rb
myreplicator-1.1.71 lib/loader/vertica/types.rb
myreplicator-1.1.69 lib/loader/vertica/types.rb
myreplicator-1.1.68 lib/loader/vertica/types.rb
myreplicator-1.1.67 lib/loader/vertica/types.rb
myreplicator-1.1.66 lib/loader/vertica/types.rb
myreplicator-1.1.65 lib/loader/vertica/types.rb
myreplicator-1.1.64 lib/loader/vertica/types.rb
myreplicator-1.1.63 lib/loader/vertica/types.rb
myreplicator-1.1.62 lib/loader/vertica/types.rb
myreplicator-1.1.61 lib/loader/vertica/types.rb
myreplicator-1.1.58 lib/loader/vertica/types.rb
myreplicator-1.1.57 lib/loader/vertica/types.rb
myreplicator-1.1.56 lib/loader/vertica/types.rb
myreplicator-1.1.55 lib/loader/vertica/types.rb
myreplicator-1.1.54 lib/loader/vertica/types.rb
myreplicator-1.1.53 lib/loader/vertica/types.rb
myreplicator-1.1.52 lib/loader/vertica/types.rb
myreplicator-1.1.51 lib/loader/vertica/types.rb
myreplicator-1.1.50 lib/loader/vertica/types.rb