Use musicbrainz_id as a key for embedded artists
This commit is contained in:
@@ -22,11 +22,10 @@ defmodule MusicLibrary.Records.Record do
|
|||||||
field :release_ids, {:array, :string}, default: []
|
field :release_ids, {:array, :string}, default: []
|
||||||
field :included_release_group_ids, {:array, :string}, default: []
|
field :included_release_group_ids, {:array, :string}, default: []
|
||||||
|
|
||||||
embeds_many :artists, Artist do
|
embeds_many :artists, Artist, primary_key: {:musicbrainz_id, :binary_id, autogenerate: false} do
|
||||||
field :name, :string
|
field :name, :string
|
||||||
field :sort_name, :string
|
field :sort_name, :string
|
||||||
field :disambiguation, :string
|
field :disambiguation, :string
|
||||||
field :musicbrainz_id, Ecto.UUID
|
|
||||||
end
|
end
|
||||||
|
|
||||||
timestamps(type: :utc_datetime)
|
timestamps(type: :utc_datetime)
|
||||||
|
|||||||
@@ -343,7 +343,6 @@ defmodule MusicLibraryWeb.CollectionLive.IndexTest do
|
|||||||
[marillion] = record.artists
|
[marillion] = record.artists
|
||||||
|
|
||||||
assert %MusicLibrary.Records.Record.Artist{
|
assert %MusicLibrary.Records.Record.Artist{
|
||||||
id: _,
|
|
||||||
name: "Marillion",
|
name: "Marillion",
|
||||||
sort_name: "Marillion",
|
sort_name: "Marillion",
|
||||||
disambiguation: "British progressive rock band",
|
disambiguation: "British progressive rock band",
|
||||||
|
|||||||
Reference in New Issue
Block a user