Option skip_on_db_migrate not honored
Hi, the option skip_on_db_migrate does not seem to be honored when set to true in the yaml options file.
My config:
# .annotaterb.yml
...
:skip_on_db_migrate: true
...
Expected behaviour
When running migrate commands annotations would not be run.
Actual behaviour
Annotations are run.
@drwl when you have a chance could I get a review on this?
@martinechtner I will review it now
I looked at the PR and was debugging locally. You are right that the skip_on_db_migrate option is not respected.
Can you share more about your workflow? I would imagine if you want to skip on db migrate then you just delete the rake task.
@drwl we have a few steps in our CI process where we need to migrate the extra output of Model files unchanged., etc was causing these steps to fail. I was able to get around the issue by setting ANNOTATERB_SKIP_ON_DB_TASKS=true when calling the migration command.
When deploying we run migrations, at this point there is no need to run annotations so honoring the skip_on_db_migrate is ideal rather than having to set ANNOTATERB_SKIP_ON_DB_TASKS=true.
We also have some CI tasks that check if annotations were run when we have migrations to ensure the correct annotations are present. That said we don't need to always run annotations when we run migrations locally in our dev environments, the additional time needed to check if there are any annotations is unnecessary, so being able to turn it off is desirable via the skip_on_db_migrate option.
Bump!
- We prefer to run annotations in a pre-commit hook
- Most
db:migratecalls are run after pulling changes frommain(not after adding a migration yourself) and in this case running annotations is unnecessary/undesired - Devs often have schema drift locally (its own issue) and so undesired annotations often sneak in
Deleting the rake task is also fine in our case. Let's remove the skip_on_db_migrate setting if that's the route forward.