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

Extract function to generate migration #10796

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

lan17
Copy link

@lan17 lan17 commented Mar 26, 2024

Description of change

Typeorm relies on a static DataSource being created and exported. However, this does not play nice with code bases where this is not desirable.

To support generating migrations in such code bases, I extracted the function to generate migration in such a way that you can just pass in instance of DataSource to it along with other options. In this manner, we should be able to use MigrationGenerateCommand.genMigration(...) without having to go through Typeorm CLI that assumes static DataSource.

Pull-Request Checklist

  • Code is up-to-date with the master branch
  • npm run format to apply prettier formatting
  • 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

@lan17
Copy link
Author

lan17 commented Mar 26, 2024

Updating tests should not be required since this is a simple refactoring change.

I did test the extracted function in my private codebase and it worked as expected.

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.

None yet

1 participant