From 791f20167bf22ca43853d6cbbf29367d9b7ac96d Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Wed, 19 Apr 2017 12:08:38 +0900 Subject: Use `quoted_scope` rather than `@config[:database]` to respect current database Related #28399. --- .../lib/active_record/connection_adapters/mysql/schema_dumper.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb b/activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb index 3e0afd9761..b66db0f6fb 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb @@ -59,9 +59,10 @@ module ActiveRecord $~[:expression].inspect end else + scope = quoted_scope(column.table_name) sql = "SELECT generation_expression FROM information_schema.columns" \ - " WHERE table_schema = #{quote(@config[:database])}" \ - " AND table_name = #{quote(column.table_name)}" \ + " WHERE table_schema = #{scope[:schema]}" \ + " AND table_name = #{scope[:name]}" \ " AND column_name = #{quote(column.name)}" select_value(sql, "SCHEMA").inspect end -- cgit v1.2.3