class AddIndexForSlowQueriesOnNetworkLevel < ActiveRecord::Migration
  def change
    unless index_exists?(:location_networks, :organisation_id)
      add_index :location_networks, :organisation_id
    end

    unless index_exists?(:network_ssids, :location_network_id)
      add_index :network_ssids, :location_network_id
    end

    unless index_exists?(:network_ssids, :organisation_id)
      add_index :network_ssids, :organisation_id
    end

    unless index_exists?(:wired_configs, :location_network_id)
      add_index :wired_configs, :location_network_id
    end

    unless index_exists?(:wired_configs, :organisation_id)
      add_index :wired_configs, :organisation_id
    end

    unless index_exists?(:v_lans, :location_network_id)
      add_index :v_lans, :location_network_id
    end

    unless index_exists?(:v_lans, :organisation_id)
      add_index :v_lans, :organisation_id
    end

    unless index_exists?(:switch_configurations, :location_network_id)
      add_index :switch_configurations, :location_network_id
    end

    unless index_exists?(:switch_configurations, :organisation_id)
      add_index :switch_configurations, :organisation_id
    end

    unless index_exists?(:radio_profiles, :location_network_id)
      add_index :radio_profiles, :location_network_id
    end

    unless index_exists?(:radio_profiles, :organisation_id)
      add_index :radio_profiles, :organisation_id
    end
  end
end
