Fix for foreign key's referencing table schemas. #6169
+61
−2
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.
Thanks for such a great project!
I used patch-package with the following when I ran into an issue with foreign keys utilizing schemas as mentioned in the title, so the basic fix for those who use that in the meantime is below.
After reading the contributing guidelines, I also created some migrations and tests for them based off of my main project where I was actually running through my own checklist of tests. As I only have set up for
mssql
so far, I have not tested against other drivers.As for why I did
if(db === DRIVER_NAMES.MsSQL) {
instead ofif (isMsSql(knex)) {
, through some digging I found that will always return false at that level, sinceknex
is undefined there.During the digging, it looked like
test/util/db-helpers.js
function getDriverName(knex)
always had undefined forknex
passed in, so I am not sure if the switch statements are working for other bits or not. If you would like me to dig into that, I can try to find time as well.Anyway, thanks again and let me know if I should change anything.