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:
parent
f63405052f
commit
deacc43030
1 changed files with 1 additions and 0 deletions
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue