automatically turn on quoting for MySQL (RT#60469)
[dbsrgits/DBIx-Class-Schema-Loader.git] / lib / DBIx / Class / Schema / Loader / RelBuilder.pm
index 5345749..c58f016 100644 (file)
@@ -14,6 +14,7 @@ use Try::Tiny;
 use Class::Unload ();
 use Class::Inspector ();
 use List::MoreUtils 'apply';
+use Encode 'decode';
 use namespace::clean;
 
 our $VERSION = '0.07010';
@@ -555,6 +556,8 @@ Could not find a proper name for relationship '$relname_new' in source '$moniker
 Supply a value in '$inflect_type' for '$relname_new_uninflected' to name this relationship.
 EOF
 
+                $relname_new = $self->_resolve_relname_collision($moniker, \@from_cols, $relname_new);
+
                 $rel->{args}[0] = $relname_new;
             }
         }
@@ -595,7 +598,7 @@ sub _relnames_and_method {
             my $class = "${remote_class}Temporary";
 
             if (not Class::Inspector->loaded($class)) {
-                my $code = slurp $existing_remote_file;
+                my $code = decode 'UTF-8', scalar slurp $existing_remote_file;
 
                 $code =~ s/(?<=package $remote_class)/Temporary/g;