Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
papb opened this issue Aug 20, 2019 · 1 comment
Closed

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

papb opened this issue Aug 20, 2019 · 1 comment
Labels
status: understood For issues. Applied when the issue is understood / reproducible. type: feature For issues and PRs. For new features. Never breaking changes.

Comments

@papb
Copy link
Member

papb commented Aug 20, 2019

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()

@papb papb added type: feature For issues and PRs. For new features. Never breaking changes. status: understood For issues. Applied when the issue is understood / reproducible. labels Aug 20, 2019
@sushantdhiman
Copy link
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.

@papb papb closed this as completed Aug 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: understood For issues. Applied when the issue is understood / reproducible. type: feature For issues and PRs. For new features. Never breaking changes.
Projects
None yet
Development

No branches or pull requests

2 participants