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

Simplify migration-shared-context #3749

Conversation

svkrieger
Copy link
Contributor

@svkrieger svkrieger commented Apr 16, 2024

A short explanation of the proposed change:

Simplify migration-shared-context and make migrations debuggable during context setup.

An explanation of the use cases your change solves

When errors are encountered during the setup of migration tests, especially when DB migrations are run up to the one which is currently being tested, it was not possible to set breakpoints in the migration file. This was because the migration-shared-context copied the currently tested migration into its own folder and also the currently tested migration + all newer migrations into another folder. So breakpoints do not work. Copying the migration files for only applying the correct migrations is not necessary. For the path we can use the normal path to the migrations folder. Additionally, we can use target to specify the migration to which we want to migrate. The correct target is calculated by using the current migrations timestamp and the latest migration's timestamp. This works for both, the up and the down path.

  • I have reviewed the contributing guide

  • I have viewed, signed, and submitted the Contributor License Agreement

  • I have made this pull request to the main branch

  • I have run all the unit tests using bundle exec rake

  • I have run CF Acceptance Tests

@svkrieger svkrieger force-pushed the simplify-migration-shared-context branch from b47cc25 to 11456b7 Compare April 16, 2024 13:30
When errors are encountered during the setup of migration tests, especially when DB migrations are run up to the one which is currently being tested, it was not possible to set breakpoints in the migration file. This was because the migration-shared-context copied the currently tested migration into its own folder and also the currently tested migration + all newer migrations into another folder. So breakpoints do not work.
Copying the migration files for only applying the correct migrations is not necessary. For the path we can use the normal path to the migrations folder. Additionally, we can use `target` to specify the migration to which we want to migrate. The correct target is calculated by using the current migrations timestamp and the latest migration's timestamp. This works for both, the up and the down path.
@svkrieger svkrieger force-pushed the simplify-migration-shared-context branch from 11456b7 to 53d185d Compare April 17, 2024 13:48
@philippthun philippthun merged commit 66ce805 into cloudfoundry:main Apr 23, 2024
8 checks passed
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.

2 participants