docs: document FK constraint behavior for role relationship

Add comment explaining on_delete: :restrict behavior for
users.role_id foreign key constraint.
This commit is contained in:
Moritz 2026-01-06 18:37:37 +01:00
parent f63405052f
commit deacc43030

View file

@ -361,6 +361,7 @@ defmodule Mv.Accounts.User do
# 1:1 relationship - User belongs to a Role # 1:1 relationship - User belongs to a Role
# This automatically creates a `role_id` attribute in the User table # This automatically creates a `role_id` attribute in the User table
# The relationship is optional (allow_nil? true by default) # The relationship is optional (allow_nil? true by default)
# Foreign key constraint: on_delete: :restrict (prevents deleting roles assigned to users)
belongs_to :role, Mv.Authorization.Role belongs_to :role, Mv.Authorization.Role
end end