class CreateUserSessions < ActiveRecord::Migration
  def change
    create_table :user_sessions, id: :uuid do |t|
      t.belongs_to :user, type: :uuid, null: false
      t.inet :ip, null: false
      t.text :user_agent, null: false
      t.timestamps null: false
    end

    add_index :user_sessions, :user_id, name: :ix_user_sessions_user_id
    add_index :user_sessions, :ip, name: :ix_user_sessions_ip
    add_index :user_sessions, :user_agent, name: :ix_user_sessions_user_agent
  end
end
