From 98775359af7553801a0f9ded0ceba4c1a9e3b584 Mon Sep 17 00:00:00 2001 From: shibao Date: Thu, 30 Mar 2023 21:39:08 -0400 Subject: [PATCH] rename shot groups to shot records in database --- ...825_rename_shot_groups_to_shot_records.exs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 priv/repo/migrations/20230331004825_rename_shot_groups_to_shot_records.exs diff --git a/priv/repo/migrations/20230331004825_rename_shot_groups_to_shot_records.exs b/priv/repo/migrations/20230331004825_rename_shot_groups_to_shot_records.exs new file mode 100644 index 00000000..1e5cd02a --- /dev/null +++ b/priv/repo/migrations/20230331004825_rename_shot_groups_to_shot_records.exs @@ -0,0 +1,19 @@ +defmodule Cannery.Repo.Migrations.RenameShotGroupsToShotRecords do + use Ecto.Migration + + def up do + drop index(:shot_groups, [:user_id, :pack_id]) + + flush() + + rename table(:shot_groups), to: table(:shot_records) + end + + def down do + rename table(:shot_records), to: table(:shot_groups) + + flush() + + create index(:shot_groups, [:user_id, :pack_id]) + end +end