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

Add RUN_MIGRATIONS flag to the service configuration #1753

Merged
merged 4 commits into from
Jul 11, 2024

Conversation

hectorgomezv
Copy link
Member

@hectorgomezv hectorgomezv commented Jul 10, 2024

Summary

This PR adds a flag to (de-)activate the database migrations execution at the service startup. The flag default value will be true unless it is explicitly set to false.

Changes

  • Adds RUN_MIGRATIONS (true by default) to control the execution of database migrations at the application bootstrap.
  • Adds a test suite for PostgresDatabaseMigrationHook.

@hectorgomezv hectorgomezv self-assigned this Jul 10, 2024
@hectorgomezv hectorgomezv requested a review from a team as a code owner July 10, 2024 15:47
@coveralls
Copy link

coveralls commented Jul 10, 2024

Pull Request Test Coverage Report for Build 9888310835

Details

  • 1 of 5 (20.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.01%) to 48.111%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/datasources/db/postgres-database.migration.hook.ts 1 5 20.0%
Totals Coverage Status
Change from base Build 9858819355: -0.01%
Covered Lines: 4245
Relevant Lines: 7083

💛 - Coveralls

@hectorgomezv hectorgomezv marked this pull request as draft July 10, 2024 16:20
@hectorgomezv hectorgomezv changed the title Add FF_RUN_MIGRATIONS Add RUN_MIGRATIONS flag to the service configuration Jul 10, 2024
@hectorgomezv hectorgomezv marked this pull request as ready for review July 10, 2024 17:06
@hectorgomezv
Copy link
Member Author

As discussed offline, we see this as a temporal security measure to provide a switch that allows the team to block the database migrations from running by setting an environment variable. For the longer term, we aim to build a more elaborate mechanism where specific migrations can be linked to feature flags, so these migrations would only apply to the database if the feature flag is active. (cc. @iamacook)

@hectorgomezv hectorgomezv merged commit 283b829 into main Jul 11, 2024
16 checks passed
@hectorgomezv hectorgomezv deleted the add-ff-run-migrations branch July 11, 2024 09:00
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.

3 participants