class CreateReceivables < ActiveRecord::Migration

  def self.up
    create_table "receivables", :force => true do |t|
      t.integer  "customer_id",       :comment => '得意先'
      t.integer  "customer_group_id", :comment => '得意先グループ'
      t.date     "cutoff_date",           :comment => '締日'
      t.date     "payment_date",          :comment => '回収日'
      t.column   "payment_type_code",     :"SMALLINT(6)", :comment => '入金方法'
      t.date     "encachement_date",      :comment => '現金化日'
      t.integer  "total_price",           :comment => '売上合計'
      t.integer  "total_duty",            :comment => '消費税合計'
      t.integer  "total_payment",         :comment => '入金合計'
      t.integer  "total_carry",           :comment => '繰越合計'
      t.integer  "pre_total",             :comment => '前回請求額'
      t.integer  "total",                 :comment => '今回請求額'
      t.integer  "trade_sheet_cnt",       :comment => '伝票枚数'
      t.datetime "print_sheet_date",      :comment => '請求書印刷日時'
      t.datetime "print_ledger_date",     :comment => '元帳印刷日時'
      t.datetime "created_at",            :comment => '作成日時'
      t.datetime "updated_at",            :comment => '更新日時'
    end
    execute "ALTER TABLE receivables COMMENT = '売掛'"
    add_index "receivables", ["customer_id"], :name => "customer_id"
    add_index "receivables", ["customer_group_id"], :name => "customer_group_id"
    add_index "receivables", ["cutoff_date"], :name => "cutoff_date"
    add_index "receivables", ["payment_date"], :name => "payment_date"
  end

  def self.down
    drop_table :receivables
  end

end
