У меня есть две таблицы devices
и devices_type
, я хочу установить значение NULL в devices.type_id
при удалении исходной строки из devices_types
.
#MyApp.Repo.Migrations.Devices
create table(:devices) do
...
add :type_id, references(:device_type, on_delete: :nothing)
...
end
#MyApp.Repo.Migrations.DeviceType
create table(:device_type) do
add :name, :string, comment: "Device type name"
end