Support `ON DELETE SET DEFAULT`
What problem are you trying to solve?
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
CREATE TABLE posts (
id SERIAL PRIMARY KEY,
content TEXT,
user_id INTEGER DEFAULT 1 REFERENCES users(id) ON DELETE SET 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.
I'm a bot. Here are possible related and/or duplicate issues (I may be wrong):
- https://github.com/dotnet/efcore/issues/7530
- https://github.com/dotnet/efcore/issues/12661
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.