Sha256: 1a40b70e1f4640a5b5b044a3e872d1285e87acf7afcff3d9770c0295ebf87b45

Contents?: true

Size: 920 Bytes

Versions: 3

Compression:

Stored size: 920 Bytes

Contents

class CreateEchiAuxReasons < ActiveRecord::Migration
  def self.up
    #We create the table from the one defined in the application.yml file
    create_table "echi_aux_reasons", :force => true do |t|
      @@echi_schema["echi_aux_reasons"].each do | field |
        case field["type"]
        when 'int'
          t.column field["name"], :integer, :limit => field["length"], :precision => field["length"], :scale => 0
        when 'str'
          t.column field["name"], :string, :limit => field["length"]
        when 'datetime'
          t.column field["name"], :datetime
        when 'bool'
          t.column field["name"], :string, :limit => 1
        when 'boolint'
          t.column field["name"], :string, :limit => 1
        end
      end
    end
    add_index "echi_aux_reasons", "aux_reason"
  end

  def self.down
    remove_index "echi_aux_reasons", "aux_reason"
    drop_table "echi_aux_reasons"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
echi-converter-0.3.5 db/migrate/006_create_echi_aux_reasons.rb
echi-converter-0.3.6 db/migrate/006_create_echi_aux_reasons.rb
echi-converter-0.3.7 db/migrate/006_create_echi_aux_reasons.rb