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

migrations that have no changes are executed on every ordnungsamt run #19

Open
philomates opened this issue Jun 11, 2021 · 0 comments
Open

Comments

@philomates
Copy link
Contributor

Every run of ordnungsamt will lookup the set of migrations registered in migrations.edn of the migrations directory and compare it to the set of migrations that have already been registered in the target repository's .migrations.edn file.

Let's say that

  • the migrations directory migrations.edn has 4 migrations with the IDs #{0 1 2 3}
  • the target repository's .migratins.edn file has 2 migrations that have been run (or manually skipped via adding an entry into this file) #{1 3}

Given this, subsequent runs of ordnungsamt will try to run migrations 0 and 2 on the target repository. If changes are detected then the migration(s) will be registered in the .migrations.edn file of the repository.

The trouble is, what if the migrations are really compute heavy (finding lots of variable references with grasp in a huge codebase) and they don't actually end up changing anything. Thus, the migration won't be registered and will be run next time.

In a sense this good because if later a change is made that should be corrected, we run again.
On the other hand, it is wasteful.

Another issue is that adding entries to .migrations.edn when nothing else in the repo has changed will result in pull requests being opened that just do administrative migration book-keeping. Merging those will trigger service deploys which is super wasteful.

idea 1:

Let's say that migration 0 and 2 are rerun again and 0 doesn't result in changes but 2 does. We could take advantage of the fact that we're opening a PR for the changes in 2 and register 0 as completed so that it won't run again in the future.

idea 2:

Provide a way to specify if a migration should always run if it hasn't been applied or should register itself and skip subsequent runs. This might be more confusion than it is worth and might still need idea 1 along with it.

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

No branches or pull requests

1 participant