Class: Chicago::Database::RedshiftStrategy Private

Inherits:
ConcreteSchemaStrategy show all
Defined in:
lib/chicago/database/concrete_schema_strategies.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Redshift-specific database schema strategy

Instance Method Summary collapse

Methods inherited from ConcreteSchemaStrategy

for_db, #integer_type, #string_type, #table_options

Instance Method Details

#column_hash(column) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



125
126
127
128
129
130
131
132
133
134
135
# File 'lib/chicago/database/concrete_schema_strategies.rb', line 125

def column_hash(column)
  hsh = super(column)
  hsh.delete(:unsigned)
  if column.column_type == :string && hsh[:size]
    # Redshift column sizes are in bytes, not characters, so
    # increase to 4 bytes per-char for UTF-8 reasons.
    hsh[:size] *= 4
  end

  hsh
end

#db_type(column) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



137
138
139
140
141
142
143
144
145
146
# File 'lib/chicago/database/concrete_schema_strategies.rb', line 137

def db_type(column)
  t = super(column)

  case t
  when :year then :smallint
  when :binary then :varchar
  else
    t
  end
end

#id_columnObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



117
118
119
120
121
122
123
# File 'lib/chicago/database/concrete_schema_strategies.rb', line 117

def id_column
  {
    :name => :id,
    :column_type => :integer,
    :unsigned => false
  }
end

#indexes(table) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Redshift does not support indexes, so do not output any.



149
150
151
# File 'lib/chicago/database/concrete_schema_strategies.rb', line 149

def indexes(table)
  []
end

#migration_optionsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



113
114
115
# File 'lib/chicago/database/concrete_schema_strategies.rb', line 113

def migration_options
  {:separate_alter_table_statements => true, :immutable_columns => true}
end