class CreateWatchVideoHistories < ActiveRecord::Migration[5.2] def change create_table :watch_video_histories do |t| t.references :watch_course_video, index: true t.references :user, index: true t.references :video, index: true t.boolean :is_finished, default: false t.float :duration, default: 0 t.float :watch_duration, default: 0 t.datetime :start_at t.datetime :end_at t.string :device t.string :ip t.timestamps end end end