From 5cae646758392425b00879045e9f6445a1c01ad8 Mon Sep 17 00:00:00 2001 From: shibao Date: Sat, 19 Nov 2022 13:14:45 -0500 Subject: [PATCH] improve indexes --- CHANGELOG.md | 1 + .../20221119170815_add_more_indexes.exs | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 priv/repo/migrations/20221119170815_add_more_indexes.exs diff --git a/CHANGELOG.md b/CHANGELOG.md index 9337c50d..b647810a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # v0.7.1 - Fix table component alignment and styling - Fix toggle button styling +- Miscellanous code improvements # v0.7.1 - Add shading to table component diff --git a/priv/repo/migrations/20221119170815_add_more_indexes.exs b/priv/repo/migrations/20221119170815_add_more_indexes.exs new file mode 100644 index 00000000..02d82c75 --- /dev/null +++ b/priv/repo/migrations/20221119170815_add_more_indexes.exs @@ -0,0 +1,16 @@ +defmodule Cannery.Repo.Migrations.AddMoreIndexes do + use Ecto.Migration + + def change do + create unique_index(:container_tags, [:tag_id, :container_id]) + + 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_types, [:user_id]) + + drop index(:shot_groups, [:id]) + create index(:shot_groups, [:user_id, :ammo_group_id]) + end +end