Use release instead of year

This commit is contained in:
Claudio Ortolina
2024-10-02 14:22:22 +01:00
parent 97b04ba8a2
commit 024d95da7c
13 changed files with 44 additions and 42 deletions
@@ -0,0 +1,25 @@
defmodule MusicLibrary.Repo.Migrations.AddReleaseToRecords do
use Ecto.Migration
import Ecto.Query
def up do
alter table(:records) do
add :release, :string
end
flush()
query =
from(r in MusicLibrary.Records.Record,
update: [set: [release: r.year]]
)
MusicLibrary.Repo.update_all(query, [])
end
def down do
alter table(:records) do
remove :release
end
end
end