From deacc43030290b4d737a11f48f136f8201512d22 Mon Sep 17 00:00:00 2001 From: Moritz Date: Tue, 6 Jan 2026 18:37:37 +0100 Subject: [PATCH] docs: document FK constraint behavior for role relationship Add comment explaining on_delete: :restrict behavior for users.role_id foreign key constraint. --- lib/accounts/user.ex | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/accounts/user.ex b/lib/accounts/user.ex index b0d919b..655dcc6 100644 --- a/lib/accounts/user.ex +++ b/lib/accounts/user.ex @@ -361,6 +361,7 @@ defmodule Mv.Accounts.User do # 1:1 relationship - User belongs to a Role # This automatically creates a `role_id` attribute in the User table # 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 end