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: default schema defined in entity/connection leads to unnecessary queries during schema sync #7575

Merged
merged 7 commits into from
Apr 17, 2021

Conversation

AlexMesser
Copy link
Collaborator

@AlexMesser AlexMesser commented Apr 16, 2021

Description of change

If you specify your default schema (public for example) in the entity or connection schema option then schema sync breaks. This PR adds checks for these cases.

Fixes #3907
Fixes #4632
Fixes #5632
Fixes #7276

Pull-Request Checklist

  • Code is up-to-date with the master branch
  • npm run lint passes with this change
  • npm run test passes with this change
  • This pull request links relevant issues as Fixes #0000
  • There are new or updated unit tests validating the change
  • Documentation has been updated to reflect this change
  • The new commits follow conventions explained in CONTRIBUTING.md

@AlexMesser AlexMesser changed the title [WIP] public schema defined in entity leads to unnecessary queries during schema sync [WIP] default schema defined in entity/connection leads to unnecessary queries during schema sync Apr 17, 2021
@AlexMesser AlexMesser changed the title [WIP] default schema defined in entity/connection leads to unnecessary queries during schema sync fix: default schema defined in entity/connection leads to unnecessary queries during schema sync Apr 17, 2021
@AlexMesser AlexMesser merged commit 7eb0327 into master Apr 17, 2021
@AlexMesser AlexMesser deleted the issue-7276 branch April 17, 2021 13:57
imnotjames added a commit that referenced this pull request Aug 24, 2021
The changes made as part of #7575 fixed some issues and introduced others. The problem became that the table name would be compared against the EntityMetadata tablePath. This would fail in some cases because while the EntityMetadata would specify database, it'd be the "default"/current database & would be omitted from the table name.

To work around that this PR introduces the database & schema on the table objects as well as a fully-qualified table path property which will always include all of them for comparing against EntityMetadata.
nebkat pushed a commit to nebkat/typeorm that referenced this pull request Sep 27, 2021
The changes made as part of typeorm#7575 fixed some issues and introduced others. The problem became that the table name would be compared against the EntityMetadata tablePath. This would fail in some cases because while the EntityMetadata would specify database, it'd be the "default"/current database & would be omitted from the table name.

To work around that this PR introduces the database & schema on the table objects as well as a fully-qualified table path property which will always include all of them for comparing against EntityMetadata.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment