You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran across this limitation when trying to automagically move content of users that delete their accounts to a Deleted User kind of an account. Most databases support it fairly easily, say
CREATETABLEposts (
id SERIALPRIMARY KEY,
content TEXT,
user_id INTEGER DEFAULT 1REFERENCES users(id) ON DELETESET DEFAULT
);
Unfortunately, EF Core only supports cascade, set null, no action, restrict, and client set null.
Describe the solution you'd like
Add .SetDetault to the DeleteBehavior enum and generate appropriate SQL.
Makes sense to me. Not sure what additional work this involves beyond adding the enum and corresponding change in MigrationsSqlGenerator (change tracking behavior, @AndriySvyryd?). Putting in the backlog for now.
Activity
MihuBot commentedon Dec 7, 2025
I'm a bot. Here are possible related and/or duplicate issues (I may be wrong):
roji commentedon Dec 8, 2025
Makes sense to me. Not sure what additional work this involves beyond adding the enum and corresponding change in MigrationsSqlGenerator (change tracking behavior, @AndriySvyryd?). Putting in the backlog for now.
Add support for ON DELETE SET DEFAULT
Add support for ON DELETE SET DEFAULT (dotnet#37380)