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

Delegate to anonymous subclass of AR::SchemaMigration #221

Closed
wants to merge 1 commit into from
Closed

Delegate to anonymous subclass of AR::SchemaMigration #221

wants to merge 1 commit into from

Conversation

defsprite
Copy link
Contributor

@defsprite defsprite commented Sep 5, 2022

I've found that adding the data_migrate gem will cause a database connection to be forced when running rails assets:precompile and was able to pin down the problem to the subclassing of ActiveRecord::SchemaMigration to create DataMigrate::DataSchemaMigration

Of course, there are workarounds like adding a nulldb adapter to make assets:precompile work in this situation, but I feel like a dependency should not force us to do this if at all possible.

Using composition in favour of inheritance and delegating to the instance does seem to fix the problem here, though there might be other ways to achieve this (e.g. deferred requiring of data_migrate/data_schema_migration)

This example app showcases the issue.

@ilyakatz
Copy link
Owner

ilyakatz commented Oct 24, 2022

Thanks for the PR! Merged via #229

@ilyakatz ilyakatz closed this Oct 24, 2022
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