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

Fix migrate:unlock failing when using wrapIdentifier knexfile option #5353

Conversation

Kytech
Copy link
Contributor

@Kytech Kytech commented Oct 12, 2022

This PR contains a small fix that resolves failure of the migrate:unlock command when used with wrapIdentifier. The error reported by migrate:unlock in such instances indicates that the lock table does not exist when there is a valid migration lock table detected in the database, as evidenced by a migrate operation failing due to the lock being set.

This issue is caused by failing to disable wrapIdentifier processing when running migrate:unlock, where other migration operations disable wrapIdentifier processing. This creates issues when wrapIdentifier alters the casing of an identifier if the database exhibits case-sensitive behavior (ex. such as Oracle when identifiers are quoted inside the query, as is standard practice in knex), resulting in the database treating the non-formatted and formatted identifier versions as two separate tables.

I attempted to add a unit test for this in test/unit/migrations/migrate/Migrator.js, though I was having issues getting the tests to run (test would freeze up and timeout), even after going back through, re-adding that test to the unit test config and resolving a few other smaller errors that existed in the file when I attempted to work with it. I didn't dig further since I wasn't sure if this small change warranted additional tests. If we feel a need to add tests for this scenario, I'd be happy to add them if someone could point me in the right direction regarding where would make most sense for testing such functionality.

@Kytech Kytech changed the title Fix migrate:unlock when used with wrapIdentifier Fix migrate:unlock failing when using wrapIdentifier knexfile option Oct 19, 2022
@baileymatthewr
Copy link
Contributor

@Kytech : Could you assign some reviewers to this PR, please?

@Kytech
Copy link
Contributor Author

Kytech commented Jul 19, 2023

@Kytech : Could you assign some reviewers to this PR, please?

I don't have the permissions to add reviewers to a PR, only the maintainers can do that. They probably just haven't triaged this PR to assign it out for review. If needed, I can open an issue and reference this PR to try to get some visibility on this.

@coveralls
Copy link

Coverage Status

coverage: 92.792% (-0.005%) from 92.797% when pulling 377cc0a on ITDeptUtahCountyGovernment:migrate-unlock-fail-custom-wrap into 7c819d3 on knex:master.

@Kytech
Copy link
Contributor Author

Kytech commented Jul 19, 2023

Since this was a very simple change, I'm not sure if we need an additional test or not, but if so, I'd be happy to add one.

@OlivierCavadenti OlivierCavadenti merged commit daeec25 into knex:master Jul 19, 2023
52 of 53 checks passed
@Kytech Kytech deleted the migrate-unlock-fail-custom-wrap branch October 12, 2023 16:12
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.

None yet

4 participants