Fix migrate:unlock
failing when using wrapIdentifier
knexfile option
#5353
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains a small fix that resolves failure of the
migrate:unlock
command when used with wrapIdentifier. The error reported bymigrate: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 runningmigrate:unlock
, where other migration operations disablewrapIdentifier
processing. This creates issues whenwrapIdentifier
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.