17 lines
528 B
Elixir
17 lines
528 B
Elixir
defmodule Ammoprices.Repo.Migrations.Add16GaugeCaliber do
|
|
use Ecto.Migration
|
|
|
|
def up do
|
|
now = DateTime.utc_now() |> DateTime.truncate(:second) |> DateTime.to_naive()
|
|
|
|
execute("""
|
|
INSERT INTO calibers (id, name, slug, category, aliases, inserted_at, updated_at)
|
|
VALUES (gen_random_uuid(), '16 Gauge', '16-gauge', 'shotgun', '{"16 gauge","16 ga","16ga"}', '#{now}', '#{now}')
|
|
ON CONFLICT (slug) DO NOTHING
|
|
""")
|
|
end
|
|
|
|
def down do
|
|
execute("DELETE FROM calibers WHERE slug = '16-gauge'")
|
|
end
|
|
end
|