-
Notifications
You must be signed in to change notification settings - Fork 9
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
Documentation for "Working around good_migrations" is incomplete/inaccurate. #38
Comments
I vaguely recall writing this, but I believe this is no longer true under zeitwerk and I'm not convinced it should be true. My inclination is to remove this from the README rather than figure out a way to work around Zeitwerk |
FWIW, a teammate spelunked into your code and found this solution to allow vetted exceptions to Good Migrations rules for a single migration:
|
Yeah, rather than rely on the particulars of which autoloader you're using and how they work, it would seem better to have an API like: GoodMigrations.allow_me_to_require_stuff_because_my_app_is_tightly_coupled_to_this_migration_and_im_too_lazy_to_inline_it do
require "…"
end |
Kinda like how |
Yeah, that's my motivation for giving it a scary name |
I think the aphorism "perfect is the enemy of good" applies here. In a perfect world, I agree that this type of interface shouldn't be necessary, but things are rarely perfect in our line of work. I think these "escape hatches" are there for good reason; we can't assume to fully know and understand every scenario a consumer of these types of tools might encounter. Maybe it's laziness, or maybe it's that implementing tools like this, long after they are due, is harder than you might think. All that said, I'd be up for opening a PR to add this feature if you would accept it. |
Yes, if you send a PR with a similarly discouraging name (along the lines of minitest's |
Per the README:
The gem only prevents auto-loading, so you can always can explicitly require the app code that you need in your migration.
But when attempting to
require
application code in a complex data migration, I was still blocked by the gem from running it. It was as if therequire
statements were not there.Does this actually work? And if so, is there more precise documentation that could point users toward how to do it?
I ended up inlining > 100 lines of duplicated application code because I couldn't require a well-tested backfill service due to this issue.
Thanks for any help!
The text was updated successfully, but these errors were encountered: