cannery/priv/repo/migrations/20220214031736_create_shot_groups.exs
shibao c7bd7238c6
Some checks failed
continuous-integration/drone/push Build is failing
improve accuracy of timestamps
2025-04-05 01:13:00 +00:00

26 lines
731 B
Elixir

defmodule Cannery.Repo.Migrations.CreateShotGroups do
use Ecto.Migration
def change do
create table(:shot_groups, primary_key: false) do
add :id, :binary_id, primary_key: true
add :count, :integer
add :notes, :string
add :date, :date
add :user_id, references(:users, on_delete: :delete_all, type: :binary_id)
add :ammo_group_id, references(:ammo_groups, on_delete: :delete_all, type: :binary_id)
timestamps(type: :naive_datetime)
end
create index(:shot_groups, [:id])
create index(:shot_groups, [:user_id])
create index(:shot_groups, [:ammo_group_id])
alter table(:ammo_groups) do
add :staged, :boolean, null: false, default: false
end
end
end