Skip to content

feat: deprecate accessing DataTypes directly on Sequelize class - #14373

Merged
WikiRik merged 4 commits into
mainfrom
ephys/deprecate-datatypes
Apr 13, 2022
Merged

WikiRik merged 4 commits into
mainfrom
ephys/deprecate-datatypes

Conversation

@ephys

@ephys ephys commented Apr 12, 2022

Copy link
Copy Markdown
Member

Pull Request Checklist

  • Have you added new tests to prevent regressions?
  • Does yarn test or yarn test-DIALECT pass with this change (including linting)?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Did you update the typescript typings accordingly (if applicable)?
  • Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?
  • Did you follow the commit message conventions explained in CONTRIBUTING.md?

Description Of Change

This PR deprecates accessing DataTypes directly on the Sequelize constructor.
Instead, users should use the DataTypes object.

These DataTypes take up a lot of possible names and should be kept in their own namespace:

// deprecated
Sequelize.STRING
Sequelize.INTEGER
// ...

// not deprecated
DataTypes.STRING
DataTypes.INTEGER
// ...

Sequelize.DataTypes.STRING
Sequelize.DataTypes.INTEGER
// ...

@ephys ephys self-assigned this Apr 12, 2022
@ephys ephys added the type: refactor DEPRECATED: replace with the "meta" issue type label Apr 12, 2022
@WikiRik

WikiRik commented Apr 12, 2022

Copy link
Copy Markdown
Member

Maybe I missed it with my quick scroll through the changes, but do we test somewhere that Sequelize.DataTypes.STRING is valid?

ephys added a commit to sequelize/website that referenced this pull request Apr 12, 2022
@ephys

ephys commented Apr 12, 2022

Copy link
Copy Markdown
Member Author

Not directly but require('@sequelize/core') returns Sequelize so const { DataTypes } = require('@sequelize/core'); is equal to Sequelize.DataTypes

@WikiRik

WikiRik commented Apr 12, 2022

Copy link
Copy Markdown
Member

Ah of course, that's true

@ephys

ephys commented Apr 12, 2022 •

Copy link
Copy Markdown
Member Author

Looks like I missed a few import updates

Edit: I accidentally fixed a DataType typo that needed to be there:

image

@ephys ephys mentioned this pull request Apr 12, 2022
6 tasks done
@ephys
ephys requested a review from a team April 13, 2022 08:39
@WikiRik
WikiRik merged commit 4bbd4fb into main Apr 13, 2022
@WikiRik
WikiRik deleted the ephys/deprecate-datatypes branch April 13, 2022 10:13
@fzn0x

fzn0x commented Apr 13, 2022

Copy link
Copy Markdown
Member

Nice changes, remove confusion between using Sequelize class workaround or not for DataTypes.

@sdepold sdepold left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we mark this as breaking change in the commit message somehow?

Good change overall

@sdepold

sdepold commented Apr 13, 2022

Copy link
Copy Markdown
Member

Oh. Too slow :(

@sdepold

sdepold commented Apr 13, 2022

Copy link
Copy Markdown
Member

Aha! There is a pr for this.

@WikiRik

WikiRik commented Apr 13, 2022 •

Copy link
Copy Markdown
Member

Aha! There is a pr for this.

To document this change? Yeah, this is indeed something that we needed to put in the upgrade guide

EDIT: sequelize/website#80

@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 7.0.0-alpha.11 🎉

The release is available on:

Your semantic-release bot 📦🚀

sdepold added a commit to sequelize/website that referenced this pull request Apr 20, 2022
* document deprecations & removals

* document PR sequelize/sequelize#14373

Co-authored-by: Sascha Depold <[email protected]>
vanthome pushed a commit to vanthome/sequelize that referenced this pull request Jun 12, 2022
…elize#14373)

* feat: deprecate accessing DataTypes directly on Sequelize class

* docs: update datatypes in jsdoc

* test: revert fixing of a datatype that needs to be broken

Co-authored-by: Rik Smale <[email protected]>
gaspardmonet added a commit to gaspardmonet/website that referenced this pull request Feb 6, 2024
* document deprecations & removals

* document PR sequelize/sequelize#14373

Co-authored-by: Sascha Depold <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released on @v7 type: refactor DEPRECATED: replace with the "meta" issue type

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants