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

undefined method `quoted_scope' for StrongMigrations::WrappedConnection #276

Closed
ViktorKopychko opened this issue Oct 9, 2024 · 2 comments

Comments

@ViktorKopychko
Copy link

Hi, @ankane

First of all thank you for this really useful gem.

I've encountered an issue when adding a virtual column.
Could you please take a look at the following?

My migration looks like this:
add_column :my_table, :active, :boolean, as: "IF(finished_at IS NULL, 1, NULL)", stored: false

When I run it the following error is printed in schema.rb

Could not dump table "my_table" because of following NoMethodError
undefined method `quoted_scope' for #<StrongMigrations::WrappedConnection:

I've discovered that this method is called from mysql/schema_dumper via send

scope = @connection.send(:quoted_scope, table_name)

StrongMigrations::WrappedConnection uses delegate_missing_to :@connection which does not cover private methods so I was able to fix it by adding

def quoted_scope(name = nil, type: nil)
   @connection.send(:quoted_scope, name, type: type)
end

to it.

What do you think about this? Should I make a PR?

Thanks!

@ankane ankane closed this as completed in 9605653 Oct 9, 2024
@ankane
Copy link
Owner

ankane commented Oct 9, 2024

Hi @ViktorKopychko, thanks for investigating and the detailed report! Fixed in the commit above.

@ViktorKopychko
Copy link
Author

@ankane that was quick, thanks a lot!

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

2 participants