replace ammo added on with purchased on

This commit is contained in:
2022-11-19 14:52:01 -05:00
parent bf0ea4168b
commit dfebad713f
37 changed files with 402 additions and 304 deletions

View File

@ -0,0 +1,19 @@
defmodule Cannery.Repo.Migrations.AddPurchaseDateToAmmoGroup do
use Ecto.Migration
def up do
alter table(:ammo_groups) do
add :purchased_on, :date
end
flush()
execute("UPDATE ammo_groups SET purchased_on = inserted_at::DATE WHERE purchased_on IS NULL")
end
def down do
alter table(:ammo_groups) do
remove :purchased_on
end
end
end