Skip to content

Bring back v4's future deletion paranoid option as a opt-in feature #11336

Closed

Description

@papb

Is your feature request related to a problem? Please describe.

In Sequelize v4, a feature that called "Future Deletion" existed, and it no longer exists in v5, since it was considered problematic (see #8496 for details).

Quoting @gabegorelick in #8496 (comment):

In Sequelize v4, if deletedAt was set to a timestamp in the future, then a record would not be considered as deleted. This was useful to schedule records for deletion. But as pointed out in this issue, it can lead to consistency issues. Thus, it was removed in v5 in favor of considering a record as deleted if deletedAt is set at all.

Describe the solution you'd like

There should be an opt-in option to enable the Future Deletion feature.

Why should this be in Sequelize

Because it was part of Sequelize in the past, and might hinder a few users from upgrading, causing them to be stuck on v4.

Describe alternatives you've considered

Alternatives would be to rewrite one's own codebase to stop needing this feature directly, perhaps using another column for this, or another approach.

Usage example

sequelize.define('user', /* ... attributes ... */, {
  // options
  paranoid: {
    enabled: true,
    futureDeletion: true
  }
}

Additional context

This issue was created to address the concerns of @yeliex in #8496 (comment):

Now we have a problem when migrating from v4 to v5, what we should do to query like
WHERE deletedAt is null or deletedAt < now()

Activity

  1. added
    type: feature
    status: understood
    on Aug 20, 2019
  2. sushantdhiman commented on Aug 21, 2019

    @sushantdhiman
    Contributor

    Rejected, we discussed this in previous issues extensively.

    IIRC I introduced that feature because I needed it in one of my projects. Now I suggest for those cases you can just add an extra column, with scopes you should be able to handle that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: understoodtype: feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions