class CreatePayings < ActiveRecord::Migration

  def self.up
    create_table "payings", :force => true do |t|
      t.integer  "rev_number",            :comment => 'リビジョン番号'
      t.date     "input_date",            :comment => '入力日'
      t.date     "target_date",           :comment => '処理日'
      t.integer  "user_id",               :comment => '入力者'
      t.integer  "section_id",            :comment => '入力者部署'
      t.integer  "supplier_id",           :comment => '仕入先'
      t.integer  "supplier_group_id",     :comment => '仕入先グループ'
      t.date     "cutoff_date",           :comment => '対象締日'
      t.column   "credit_timing_code",    :"SMALLINT(6)", :comment => '支払時期'
      t.column   "cutoff_date_code",      :"SMALLINT(6)", :comment => '締日'
      t.column   "currency_type_code",    :"SMALLINT(6)", :comment => '通貨'
      t.integer  "total_amount",          :comment => '合計金額'
      t.column   "state_code",            :"SMALLINT(6)", :comment => '状態'
      t.string   "note",                  :limit => 200, :comment => '備考'
      t.column   "invalid_flag_code",     :"SMALLINT(6)", :comment => '削除フラグ'
      t.datetime "deleted_at",            :comment => '削除日時'
      t.datetime "created_at",            :comment => '作成日時'
      t.datetime "updated_at",            :comment => '更新日時'
    end
    execute "ALTER TABLE payings COMMENT = '支払'"
    add_index "payings", ["target_date"], :name => "target_date"
    add_index "payings", ["supplier_id"], :name => "supplier_id"
    add_index "payings", ["cutoff_date"], :name => "cutoff_date"
    add_index "payings", ["invalid_flag_code"], :name => "invalid_flag_code"
  end

  def self.down
    drop_table :payings
  end

end
