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

Tweak migrations to match current Rails version. #81

Merged
merged 1 commit into from
Jul 10, 2021
Merged

Conversation

pat
Copy link
Owner

@pat pat commented Jul 10, 2021

As discussed in #80, the current approach to migrations in engines is flawed. So, instead of the clunky check in each migration, we can instead use a generator to update them to use the current Rails version at the time of the migrations being added. The test suite uses this approach too, so we can be sure that the migrations work in each Rails release. Essentially, this automates the recommendation in 0433427.

It's not quite perfect - if new migrations get added to Gutentag, and someone's upgrading their app, the generator will be invoked on all Gutentag migrations (so, editing the old ones to use a potentially newer version of Rails). But at this point in time I'm not expecting further migrations - so, we can look into improving this if that changes.

As discussed in #80, the current approach to migrations in engines is flawed. So, instead of the clunky check in each migration, we can instead use a generator to update them to use the current Rails version at the time of the migrations being added. The test suite uses this approach too, so we can be sure that the migrations work in each Rails release. Essentially, this automates the recommendation in 0433427.

It's not quite perfect - if new migrations get added to Gutentag, and someone's upgrading their app, the generator will be invoked on all Gutentag migrations (so, editing the old ones to use a potentially newer version of Rails). But at this point in time I'm not expecting further migrations - so, we can look into improving this if that changes.
@pat pat force-pushed the feature/generator branch from 7547f51 to f27c9cb Compare July 10, 2021 06:34
@pat pat merged commit 7e8b515 into master Jul 10, 2021
@pat pat deleted the feature/generator branch September 18, 2021 02:57
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.

1 participant