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