class CreateUserCourseVisits < ActiveRecord::Migration[5.1] def change return unless BridgeCache.use_internal_database create_table :bridge_cache_user_course_visits do |t| t.string :token t.datetime :date t.integer :user_id, limit: 8 t.integer :account_id, limit: 8 t.integer :seconds t.datetime :last_updated t.integer :course_template_id, limit: 8 t.integer :enrollment_id, limit: 8 t.integer :tracked_seconds t.datetime :bridge_created_at t.datetime :bridge_updated_at t.timestamps end add_unique_constraint :bridge_cache_user_course_visits, [:token], deferrable: false, name: 'bridge_cache_uc_visits_uniq_token' add_index :bridge_cache_user_course_visits, :token add_index :bridge_cache_user_course_visits, :enrollment_id add_index :bridge_cache_user_course_visits, :user_id add_index :bridge_cache_user_course_visits, :course_template_id add_index :bridge_cache_user_course_visits, :updated_at end end