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

Feature Request: Possibility to change the DataType of deletedAt for Paranoid Tables #14257

Open
3 of 7 tasks
weisinlakd opened this issue Mar 17, 2022 · 1 comment
Open
3 of 7 tasks
Labels
type: feature For issues and PRs. For new features. Never breaking changes.

Comments

@weisinlakd
Copy link

weisinlakd commented Mar 17, 2022

Issue Creation Checklist

Feature Description

The ability to set the DataType of the column used for Paranoid tables to boolean (or other types).

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

When using Sequelize ORM with pre-existent databases, if said database has the soft deletion method as a boolean column (or otherwise) the developer can't take full advantage of the ORM's Paranoid Tables feature because they can only change the name of the table's column, and not the dataType; leading to manually implementing the filters that are already present in said feature.

Describe the solution you'd like

Ideally the possibility to change the dataType of the column in the options object of a Model when init().

Why should this be in Sequelize

Because it is a very common situation when interacting with pre-existing databases and most of the time the developer can not modify the schema to fit Sequelize.

Feature Request Checklist

Is this feature dialect-specific?

  • No. This feature is relevant to Sequelize as a whole.
  • Yes. This feature only applies to the following dialect(s): XXX, YYY, ZZZ

Would you be willing to implement this feature by submitting a Pull Request?

  • Yes, I have the time and I know how to start.
  • Yes, I have the time but I don't know how to start, I would need guidance.
  • No, I don't have the time, although I believe I could do it if I had the time...
  • No, I don't have the time and I wouldn't even know how to start.
@ephys ephys added the type: feature For issues and PRs. For new features. Never breaking changes. label Mar 17, 2022
@ephys
Copy link
Member

ephys commented Mar 17, 2022

This is by design. As Sequelize needs to set & compare the contents of the deletedAt attribute, only a small subset of types can be supported.

Right now the only supported type is DATETIME. Supporting booleans would require putting a new system in place that generates a different query based on the type of deletedAt.

This RFC is somewhat related: #14303

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature For issues and PRs. For new features. Never breaking changes.
Projects
None yet
Development

No branches or pull requests

2 participants