Skip to content

fix: changeColumn function - #14477

Draft
lohart13 wants to merge 3 commits into
sequelize:mainfrom
lohart13:mssql-fix-alter
Draft

lohart13 wants to merge 3 commits into
sequelize:mainfrom
lohart13:mssql-fix-alter

Conversation

@lohart13

@lohart13 lohart13 commented May 2, 2022 •

Copy link
Copy Markdown
Contributor

Pull Request Checklist

Please make sure to review and check all of these items:

  • 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

The changeColumn function in the query interface does not currently work when constraints are defined (either default values or unique columns) for MSSQL. By checking if the constraint exists for the column and recreating if required, this allow the changeColumn function to work with MSSQL.

The test for the changeColumn function has been excluded for MSSQL as the new function calls two other SQL queries prior to the final query and the stub picks up the first query causing the test to fail.

Todos

  • Update docs if required
  • Add test if required

@lohart13
lohart13 marked this pull request as draft May 3, 2022 04:24
@ephys

ephys commented May 28, 2022

Copy link
Copy Markdown
Member

Hi :)
This PR is marked as draft, is that intended? Do you need anything for it to be ready?

@lohart13
lohart13 marked this pull request as ready for review June 1, 2022 02:50
@lohart13

lohart13 commented Jun 1, 2022

Copy link
Copy Markdown
Contributor Author

Hi :) This PR is marked as draft, is that intended? Do you need anything for it to be ready?

Yes it's ready now

@ephys
ephys self-requested a review June 9, 2022 21:25

@ephys ephys 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 you add an integration test (in the integration folder, that runs against the database) that was failing prior to this PR, but is passing now?

@lohart13
lohart13 force-pushed the mssql-fix-alter branch 2 times, most recently from 2a28e7f to 653e838 Compare June 20, 2022 19:34
@lohart13

Copy link
Copy Markdown
Contributor Author

Can you add an integration test (in the integration folder, that runs against the database) that was failing prior to this PR, but is passing now?

Tests added, I had the make some changes to that Db2 also support the default value changes

@lohart13 lohart13 changed the title MSSQL add changeColumn function Db2 & MSSQL add changeColumn function Jun 20, 2022
@lohart13
lohart13 requested a review from ephys June 20, 2022 19:52
@ephys

ephys commented Jun 27, 2022

Copy link
Copy Markdown
Member

The way changeColumn is written, specifically the part of the code that checks whether a generated SQL string includes REFERENCES or DEFAULT or UNIQUE, etc…, is broken so I started a complete rewrite of the changeColumn function over at #14687

I'll incorporate your changes into that PR

@lohart13

Copy link
Copy Markdown
Contributor Author

The way changeColumn is written, specifically the part of the code that checks whether a generated SQL string includes REFERENCES or DEFAULT or UNIQUE, etc…, is broken so I started a complete rewrite of the changeColumn function over at #14687

I'll incorporate your changes into that PR

Thanks @ephys, sounds good.
Do you want me to close this PR?

@ephys

ephys commented Jun 27, 2022

Copy link
Copy Markdown
Member

No, we'll close it once the other PR is ready, I prefer to keep it open as a reminder that I still need to include the changes once I get to mssql :)

@lohart13

Copy link
Copy Markdown
Contributor Author

No problem, looking forward to seeing the PR completed.
Let me know if you need anything else.

@lohart13
lohart13 marked this pull request as draft October 19, 2022 19:15
@lohart13
lohart13 force-pushed the mssql-fix-alter branch 2 times, most recently from b193b64 to 4e51193 Compare November 30, 2022 03:50
@lohart13
lohart13 force-pushed the mssql-fix-alter branch 2 times, most recently from 626ad7d to 89ba28a Compare March 20, 2023 04:43
@lohart13
lohart13 force-pushed the mssql-fix-alter branch 2 times, most recently from c6de802 to a21dc4c Compare June 29, 2023 02:41
@lohart13
lohart13 force-pushed the mssql-fix-alter branch 2 times, most recently from 4e4f406 to 9583cb9 Compare July 19, 2023 09:01
@lohart13 lohart13 changed the title Db2 & MSSQL add changeColumn function fix: changeColumn function Sep 11, 2023
@WikiRik

WikiRik commented Sep 11, 2023

Copy link
Copy Markdown
Member

I see the name of this PR changed, I think as maintainers we prefer #14687 over this PR. @lohart13 @ephys maybe you can discuss amongst each other if there is anything that Luke can do to help you? It would be a shame if more work is spent on this PR if we're not implementing this in the end

@lohart13
lohart13 force-pushed the mssql-fix-alter branch 2 times, most recently from e25f7bd to fc52029 Compare September 12, 2023 03:06
@lohart13

Copy link
Copy Markdown
Contributor Author

@WikiRik as per @ephys comments in the above chain, this PR is being left open so the changes can be ported over to #14687.

I'm keeping this branch updated as I'm using it in a project.

@WikiRik

WikiRik commented Sep 12, 2023

Copy link
Copy Markdown
Member

I'm keeping this branch updated as I'm using it in a project.

Ah, I didn't know but in that case it makes sense to keep this updated. Thanks for the response!

@lohart13
lohart13 force-pushed the mssql-fix-alter branch 2 times, most recently from 95f8692 to 9ed01b4 Compare January 29, 2024 22:23
@lohart13
lohart13 force-pushed the mssql-fix-alter branch 2 times, most recently from 80456b2 to 21e7473 Compare April 12, 2024 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants