-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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 hasTable
is undefined for schema postgres users
#15702
Conversation
Codecov ReportBase: 59.11% // Head: 59.11% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## main #15702 +/- ##
=======================================
Coverage 59.11% 59.11%
=======================================
Files 1502 1502
Lines 38360 38360
Branches 7385 7385
=======================================
Hits 22677 22677
Misses 13411 13411
Partials 2272 2272
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@@ -32,7 +32,7 @@ const getLinksWithoutMappedBy = (db) => { | |||
|
|||
const isLinkTableEmpty = async (db, linkTableName) => { | |||
// If the table doesn't exist, it's empty | |||
const exists = await db.getConnection().schema.hasTable(linkTableName); | |||
const exists = await db.getSchemaConnection().hasTable(linkTableName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot we had getSchemaConnection. Good catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a random question: why is this not catched by any test? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a very good question and a thing we could discuss better.
This is caused by a custom configuration on postgres we didnt account for. For the default config is working ok.
We have faced multiple issues caused by db configs
GTID issues
Mariadb clusters
Postgress custom schemas
We could extend this list and periodically test for it, or see if there is a possibility to add it in the CI.
It is quite complicated to account for things like this in our current tests today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. I imagine it would be quite hard to run all tests against every combination of configuration. Do you see a way to create tests, e.g. to mimic a specific configuration? E.g. to mock something in a way to simulate such a configuration?
What does it do?
Fix #15603
Why is it needed?
Users using postgres with a schema and having the double inverseBy bug (#14428) cannot start Strapi.
How to test it?
./config/database.js
:mappedBy
mappedBy
byinversedBy
Related issue(s)/PR(s)
#15603