diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-04-19 12:08:38 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-04-19 12:41:54 +0900 |
commit | 791f20167bf22ca43853d6cbbf29367d9b7ac96d (patch) | |
tree | bdeeaf51ebd17a7f0bdaa4ac117ac8d6f3a3dc12 /activerecord/lib/active_record/connection_adapters | |
parent | dc107956c933269d652cb8d283cf071bdbdb2066 (diff) | |
download | rails-791f20167bf22ca43853d6cbbf29367d9b7ac96d.tar.gz rails-791f20167bf22ca43853d6cbbf29367d9b7ac96d.tar.bz2 rails-791f20167bf22ca43853d6cbbf29367d9b7ac96d.zip |
Use `quoted_scope` rather than `@config[:database]` to respect current database
Related #28399.
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb | 5 |
1 files changed, 3 insertions, 2 deletions
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 |