2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-11-14 16:39:07 -05:00
|
|
|
class AddTimeReadToUserVisits < ActiveRecord::Migration[5.1]
|
|
|
|
def up
|
|
|
|
add_column :user_visits, :time_read, :integer, null: false, default: 0 # in seconds
|
|
|
|
add_index :user_visits, %i[user_id visited_at time_read]
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
remove_index :user_visits, %i[user_id visited_at time_read]
|
|
|
|
remove_column :user_visits, :time_read
|
|
|
|
end
|
|
|
|
end
|