Sha256: d3f162d3b6ed141ce6a822f6144943638e600bb3208bd156532668a6b6a6765e

Contents?: true

Size: 808 Bytes

Versions: 1

Compression:

Stored size: 808 Bytes

Contents

class CreateEchiReasons < ActiveRecord::Migration
  def self.up
    #We create the table from the one defined in the application.yml file
    create_table "echi_reasons", :force => true do |t|
      @@echi_schema["echi_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
  end

  def self.down
    drop_table "echi_reasons"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
echi-converter-0.3.8 db/migrate/006_create_echi_reasons.rb