Module: ColumnDefs

Defined in:
common/db/db_migrator.rb

Class Method Summary collapse

Class Method Details

.blobField(name, opts = {}) ⇒ Object



42
43
44
45
46
47
48
49
50
# File 'common/db/db_migrator.rb', line 42

def self.blobField(name, opts = {})
  if $db_type == :postgres
    [name, :bytea, opts]
  elsif $db_type == :h2
    [name, String, opts.merge(:size => 128000)]
  else
    [name, :blob, opts]
  end
end

.halfLongString(name, opts = {}) ⇒ Object



28
29
30
# File 'common/db/db_migrator.rb', line 28

def self.halfLongString(name, opts = {})
  [name, String, opts.merge(:size => 8704)]
end

.longString(name, opts = {}) ⇒ Object



24
25
26
# File 'common/db/db_migrator.rb', line 24

def self.longString(name, opts = {})
  [name, String, opts.merge(:size => 17408)]
end

.mediumBlobField(name, opts = {}) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
# File 'common/db/db_migrator.rb', line 53

def self.mediumBlobField(name, opts = {})
  if $db_type == :postgres
    [name, :bytea, opts]
  elsif $db_type == :h2
    [name, String, opts.merge(:size => 128000)]
  elsif $db_type == :mysql
    [name, :mediumblob, opts]
  else
    [name, :blob, opts]
  end
end

.textBlobField(name, opts = {}) ⇒ Object



33
34
35
36
37
38
39
# File 'common/db/db_migrator.rb', line 33

def self.textBlobField(name, opts = {})
  if $db_type == :derby
    [name, :clob, opts]
  else
    self.blobField(name, opts)
  end
end

.textField(name, opts = {}) ⇒ Object



15
16
17
18
19
20
21
# File 'common/db/db_migrator.rb', line 15

def self.textField(name, opts = {})
  if $db_type == :derby
    [name, :clob, opts]
  else
    [name, :text, opts]
  end
end