Skip to content

Commit

Permalink
Update introspection and migration options for ecto_sql 3.12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mbklein committed Oct 2, 2024
1 parent 4e5db36 commit c1ecc2a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion app/lib/meadow/data/schemas/validations.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ defmodule Meadow.Data.Schemas.Validations do
def prepare_embed(%Ecto.Changeset{data: data, params: params} = change, field)
when is_atom(field) do
empty_struct = fn ->
{:parameterized, _type, field_spec} = data.__struct__.__schema__(:type, field)
field_spec =
case data.__struct__.__schema__(:type, field) do
{:parameterized, _type, f} -> f
{:parameterized, {_type, f}} -> f
end

field_spec.related.__struct__ |> Map.from_struct()
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ defmodule Meadow.Repo.Migrations.CreateFileSets do
add(:extracted_metadata, :map, default: %{})
add(:structural_metadata, :map, default: %{})
add(:derivatives, :map, default: %{})
add(:work_id, references(:works, null: false, on_delete: :delete_all))
add(:work_id, references(:works, on_delete: :delete_all), null: false)
add(:rank, :integer)
add(:poster_offset, :integer)

Expand Down

0 comments on commit c1ecc2a

Please sign in to comment.