From e171e6aef534a84126c9b0108d12406ad3c8ebb7 Mon Sep 17 00:00:00 2001 From: Yvan Cottyn Date: Fri, 8 Mar 2019 12:16:00 +0100 Subject: [PATCH] Downcase keys in result row hash. For me MySQL (Percona server 8.0.13) is returning all caps keys in the result row hash which makes db:schema:dump fail. --- .../views/active_record/connection_adapters/mysql2_adapter.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/schema_plus/views/active_record/connection_adapters/mysql2_adapter.rb b/lib/schema_plus/views/active_record/connection_adapters/mysql2_adapter.rb index dac8218..b50e837 100644 --- a/lib/schema_plus/views/active_record/connection_adapters/mysql2_adapter.rb +++ b/lib/schema_plus/views/active_record/connection_adapters/mysql2_adapter.rb @@ -7,6 +7,7 @@ def view_definition(view_name, name = nil) results = select_all("SELECT view_definition, check_option FROM information_schema.views WHERE table_schema = SCHEMA() AND table_name = #{quote(view_name)}", name) if results.any? row = results.first + row.transform_keys!(&:downcase) sql = row["view_definition"] sql.gsub!(%r{#{quote_table_name(current_database)}[.]}, '') case row["check_option"]