class AddStatusEndTimeForHackUserLastestCode < ActiveRecord::Migration[5.2]
  def change
    add_column :hack_user_lastest_codes, :passed, :boolean, :default => false
    add_column :hack_user_lastest_codes, :pass_time, :timestamp
    add_column :hack_user_lastest_codes, :identifier, :string
    add_column :hack_user_lastest_codes, :language, :string
    add_column :hack_user_debugs, :hack_user_lastest_code_id, :integer
    add_column :hacks, :hack_user_lastest_codes_count, :integer, :default => 0
    add_column :hacks, :pass_num, :integer, :default => 0
    add_column :hacks, :submit_num, :integer, :default => 0
    add_column :hack_user_codes, :input, :text
    add_index :hack_user_lastest_codes, :user_id, name: "user_index"
    add_index :hack_user_lastest_codes, :hack_id, name: "hack_index"
    add_index :hack_user_lastest_codes, :identifier, unique: true
    add_index :hack_user_debugs, :hack_user_lastest_code_id, unique: true
    add_column :hack_user_lastest_codes, :submit_status, :integer, :default => 0
    add_column :hack_user_lastest_codes, :status, :integer
    add_column :hack_user_lastest_codes, :passed_time, :timestamp
    add_column :hack_user_debugs, :status, :integer

    add_column :hack_user_codes, :execute_time, :integer
    add_column :hack_user_codes, :execute_memory, :integer
    add_column :hack_user_debugs, :execute_time, :integer
    add_column :hack_user_debugs, :execute_memory, :integer

  end
end
