forked from shibao/cannery
		
	remove unnecessary index churn
This commit is contained in:
		@@ -3,11 +3,6 @@ defmodule Cannery.Repo.Migrations.RenameAmmoGroupsToPacks do
 | 
			
		||||
 | 
			
		||||
  def up do
 | 
			
		||||
    drop index(:ammo_groups, [:user_id], where: "count = 0", name: :empty_ammo_groups_index)
 | 
			
		||||
    drop index(:ammo_groups, [:user_id, :ammo_type_id])
 | 
			
		||||
    drop index(:ammo_groups, [:user_id, :container_id])
 | 
			
		||||
    drop index(:ammo_groups, [:ammo_type_id])
 | 
			
		||||
    drop index(:ammo_groups, [:container_id])
 | 
			
		||||
    drop index(:ammo_groups, [:user_id])
 | 
			
		||||
 | 
			
		||||
    flush()
 | 
			
		||||
 | 
			
		||||
@@ -16,22 +11,11 @@ defmodule Cannery.Repo.Migrations.RenameAmmoGroupsToPacks do
 | 
			
		||||
    flush()
 | 
			
		||||
 | 
			
		||||
    create index(:packs, [:user_id], where: "count = 0", name: :empty_packs_index)
 | 
			
		||||
    create index(:packs, [:user_id, :ammo_type_id])
 | 
			
		||||
    create index(:packs, [:user_id, :container_id])
 | 
			
		||||
    create index(:packs, [:ammo_type_id])
 | 
			
		||||
    create index(:packs, [:container_id])
 | 
			
		||||
    create index(:packs, [:user_id])
 | 
			
		||||
 | 
			
		||||
    rename table(:shot_groups), :ammo_group_id, to: :pack_id
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def down do
 | 
			
		||||
    drop index(:packs, [:user_id], where: "count = 0", name: :empty_packs_index)
 | 
			
		||||
    drop index(:packs, [:user_id, :ammo_type_id])
 | 
			
		||||
    drop index(:packs, [:user_id, :container_id])
 | 
			
		||||
    drop index(:packs, [:ammo_type_id])
 | 
			
		||||
    drop index(:packs, [:container_id])
 | 
			
		||||
    drop index(:packs, [:user_id])
 | 
			
		||||
 | 
			
		||||
    flush()
 | 
			
		||||
 | 
			
		||||
@@ -40,12 +24,6 @@ defmodule Cannery.Repo.Migrations.RenameAmmoGroupsToPacks do
 | 
			
		||||
    flush()
 | 
			
		||||
 | 
			
		||||
    create index(:ammo_groups, [:user_id], where: "count = 0", name: :empty_ammo_groups_index)
 | 
			
		||||
    create index(:ammo_groups, [:user_id, :ammo_type_id])
 | 
			
		||||
    create index(:ammo_groups, [:user_id, :container_id])
 | 
			
		||||
    create index(:ammo_groups, [:ammo_type_id])
 | 
			
		||||
    create index(:ammo_groups, [:container_id])
 | 
			
		||||
    create index(:ammo_groups, [:user_id])
 | 
			
		||||
 | 
			
		||||
    rename table(:shot_groups), :pack_id, to: :ammo_group_id
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user