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

feat: rename typeorm_metadata table #8528

Merged
merged 2 commits into from Jan 31, 2022

Conversation

varanauskas
Copy link
Contributor

Description of change

This new feature adds a new connection option metadataTableName that allows for renaming of the typeorm_metadata table

This was needed to allow users to rename the typeorm_metadata table if they needed it.
For example multiple typeorm services using the same database could clash on creating/updating the table in their migrations.

Fixes: #7266

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
    Unable to run full test suite, due to missing SAP Hana (and perhaps others)
    But added a new test suite that is passing
  • 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
    English documentation has been updated, CN documentation updated partially
  • The new commits follow conventions explained in CONTRIBUTING.md

This new feature adds a new connection option `metadataTableName`
that allows for renaming of the `typeorm_metadata` table

Closes: typeorm#7266
@varanauskas
Copy link
Contributor Author

This is my first PR in TypeORM, so could you review the design choice I made:

I have moved the canonical name of the typeorm_metadata table to Connection (comparable to how namingStrategy is set up) as both the SchemaBuilder and QueryRunner needed it, and they both had access to the connection.
Should the canonical name (TYPEORM_METADATA_TABLE_NAME || "typeorm_metadata") be moved elsewhere?

(Mirrors PR #8469, changed source branch name)

@pleerock
Copy link
Member

Ideally this name should be in the naming strategy itself, however I see migrationsTableName is already not there. So I'm okay with current implementation. I think this PR can be merged.

@pleerock pleerock merged commit f8154eb into typeorm:master Jan 31, 2022
@pleerock
Copy link
Member

Thank you for contribution! 🎉

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.

rename table typeorm_metadata name
3 participants