diff --git a/lib/database_collation.rb b/lib/database_collation.rb index 9716ea3475a..5753ee56328 100644 --- a/lib/database_collation.rb +++ b/lib/database_collation.rb @@ -59,6 +59,13 @@ def supported_collations map { |row| row['collname'] } end + def database_encoding + @database_encoding ||= connection.execute("SELECT encoding FROM " \ + "pg_database WHERE datname = " \ + "'#{connection.current_database}';"). + first["encoding"] + end + def adapter_name @adapter_name ||= connection.adapter_name end