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

Add support for ALTER TABLE REMOVE COLUMN for the removeColumn method for SQLite #15205

Open
4 of 8 tasks
clearazil opened this issue Oct 30, 2022 · 1 comment
Open
4 of 8 tasks
Labels
dialect: sqlite For issues and PRs. Things that involve SQLite (and do not involve all dialects). type: refactor For issues and PRs. Things that improve the code readability, maintainability, testability, etc.

Comments

@clearazil
Copy link

Issue Creation Checklist

  • I understand that my issue will be automatically closed if I don't fill in the requested information
  • I have read the contribution guidelines

Feature Description

Describe the feature you'd like to see implemented

I noticed that Sequelize drops tables (and recreates them with the data) with SQLite when using the changeColumn and removeColumn methods:
https://sequelize.org/docs/v6/other-topics/query-interface/#changing-and-removing-columns-in-sqlite

I don't think SQLite has added support for changing a table, but support for ALTER TABLE DROP COLUMN has been added since version 3.35.0:
https://www.sqlite.org/releaselog/3_35_0.html

Describe why you would like this feature to be added to Sequelize

SQLite now supports removing columns.

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): SQLite

Would you be willing to resolve this issue by submitting a Pull Request?

  • Yes, I have the time and I know how to start.
  • Yes, I have the time but I will need guidance.
  • No, I don't have the time, but my company or I are supporting Sequelize through donations on OpenCollective.
  • No, I don't have the time, and I understand that I will need to wait until someone from the community or maintainers is interested in implementing my feature.

Indicate your interest in the addition of this feature by adding the 👍 reaction. Comments such as "+1" will be removed.

@WikiRik WikiRik added type: refactor For issues and PRs. Things that improve the code readability, maintainability, testability, etc. dialect: sqlite For issues and PRs. Things that involve SQLite (and do not involve all dialects). labels Oct 30, 2022
@WikiRik
Copy link
Member

WikiRik commented Oct 30, 2022

Thanks for letting us know this is a possibility now!
For the person that will be working on this in the future; do note that removing a column that is a PRIMARY KEY or has a UNIQUE constraint cannot be dropped with this syntax, as per the docs. So in some cases the old workaround still needs to be used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dialect: sqlite For issues and PRs. Things that involve SQLite (and do not involve all dialects). type: refactor For issues and PRs. Things that improve the code readability, maintainability, testability, etc.
Projects
None yet
Development

No branches or pull requests

2 participants