Sha256: feb78c6035cedb54f872b4980949d7d4e376e5d33202792f71b2b2ec298e6d6f

Contents?: true

Size: 871 Bytes

Versions: 2

Compression:

Stored size: 871 Bytes

Contents

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

  def self.down
    remove_index "echi_acds", "acd_id"
    drop_table "echi_acds"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
echi-converter-0.3.7 db/migrate/009_create_echi_acds.rb
echi-converter-0.3.8 db/migrate/009_create_echi_acds.rb