Skip to content

Support ON DELETE SET DEFAULT #37312

Closed

Description

@Atulin

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.

Activity

  1. MihuBot commented on Dec 7, 2025

    @MihuBot

    I'm a bot. Here are possible related and/or duplicate issues (I may be wrong):

  2. roji commented on Dec 8, 2025

    @roji
    Member

    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.

  3. added this to the Backlog milestone on Dec 8, 2025
  4. added theissue type on Dec 8, 2025
  5. added a commit that references this issue on Dec 15, 2025
    7d770c1
  6. added a commit that references this issue on Dec 22, 2025
    0b1afb4
  7. modified the milestones: Backlog, 11.0.0 on Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions