fix: use attribute.name if attribute.source is nil

This commit is contained in:
Zach Daniel 2022-06-28 15:57:30 -04:00
parent 2b32f916b3
commit 71ddb28332

View file

@ -1892,7 +1892,7 @@ defmodule AshPostgres.MigrationGenerator do
if attribute.source == source_field_name && relationship.type == :belongs_to &&
foreign_key?(relationship) do
configured_reference =
configured_reference(resource, table, attribute.source, relationship)
configured_reference(resource, table, attribute.source || attribute.name, relationship)
unless Map.get(configured_reference, :ignore?) do
destination_field_source =