cannery/priv/repo/migrations/20210903015611_create_ammo_groups.exs

23 lines
711 B
Elixir
Raw Permalink Normal View History

2021-09-02 23:31:14 -04:00
defmodule Cannery.Repo.Migrations.CreateAmmoGroups do
use Ecto.Migration
def change do
create table(:ammo_groups, primary_key: false) do
add :id, :binary_id, primary_key: true
add :count, :integer
add :price_paid, :float
add :notes, :text
2021-09-12 19:06:26 -04:00
add :ammo_type_id, references(:ammo_types, on_delete: :delete_all, type: :binary_id)
2021-09-02 23:31:14 -04:00
add :container_id, references(:containers, on_delete: :nothing, type: :binary_id)
2021-09-12 19:06:26 -04:00
add :user_id, references(:users, on_delete: :delete_all, type: :binary_id)
2021-09-02 23:31:14 -04:00
timestamps()
end
create index(:ammo_groups, [:ammo_type_id])
create index(:ammo_groups, [:container_id])
create index(:ammo_groups, [:user_id])
end
end