{"action":"created","issue":{"url":"https://api.github.com/repos/jjn1056/DBIx-Class-Migration/issues/108","repository_url":"https://api.github.com/repos/jjn1056/DBIx-Class-Migration","labels_url":"https://api.github.com/repos/jjn1056/DBIx-Class-Migration/issues/108/labels{/name}","comments_url":"https://api.github.com/repos/jjn1056/DBIx-Class-Migration/issues/108/comments","events_url":"https://api.github.com/repos/jjn1056/DBIx-Class-Migration/issues/108/events","html_url":"https://github.com/jjn1056/DBIx-Class-Migration/issues/108","id":346327074,"node_id":"MDU6SXNzdWUzNDYzMjcwNzQ=","number":108,"title":"respect UTF8","user":{"login":"KES777","id":799021,"node_id":"MDQ6VXNlcjc5OTAyMQ==","avatar_url":"https://avatars1.githubusercontent.com/u/799021?v=4","gravatar_id":"","url":"https://api.github.com/users/KES777","html_url":"https://github.com/KES777","followers_url":"https://api.github.com/users/KES777/followers","following_url":"https://api.github.com/users/KES777/following{/other_user}","gists_url":"https://api.github.com/users/KES777/gists{/gist_id}","starred_url":"https://api.github.com/users/KES777/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KES777/subscriptions","organizations_url":"https://api.github.com/users/KES777/orgs","repos_url":"https://api.github.com/users/KES777/repos","events_url":"https://api.github.com/users/KES777/events{/privacy}","received_events_url":"https://api.github.com/users/KES777/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-07-31T19:30:21Z","updated_at":"2018-09-07T08:19:47Z","closed_at":null,"author_association":"NONE","body":"If my `Result/Table.pm` looks like:\r\n```\r\nuse utf8;\r\n...\r\nsub sqlt_deploy_hook {\r\n        my( $self, $sqlt_table ) =  @_;\r\n\r\n        my $sqlt =  $sqlt_table->schema;\r\n        $sqlt->add_procedure(()\r\n                ,name =>  'ch_saldo'\r\n                ....\r\n                ,extra =>  {()\r\n                        ,returns =>  { type => 'VOID' }\r\n                        ,definitions =>  [()\r\n                                ,{ language  =>  'plpgsql'  }\r\n                                ,{ attribute =>  'VOLATILE' }\r\n                                ,{ quote => \"\\$\\$\\n\",  body => <<'      FUNC' =~ s!^\\t\\t!  !grm  =~\r\n                /*Только суммарный учёт по счёту*/\r\n                DECLARE _YearFrom  smallint;\r\n                DECLARE _YearTo    smallint;\r\n```\r\nWhen I run `prepare` command I get migration script with broken comments:\r\n```\r\nCREATE FUNCTION \"ch_saldo\" (in _DocDate DATE, in _Schet TBuhSchet, in _Suma TMoney)\r\n RETURNS VOID\r\n LANGUAGE plpgsql\r\n VOLATILE\r\n AS $$\r\n  /*Ð¢Ð¾Ð»ÑÐºÐ¾ ÑÑÐ¼Ð¼Ð°ÑÐ½ÑÐ¹ ÑÑÑÑ Ð¿Ð¾ ÑÑÑÑÑ*/\r\n  DECLARE _YearFrom  smallint;/**/\r\n  DECLARE _YearTo    smallint;/**/\r\n```"},"comment":{"url":"https://api.github.com/repos/jjn1056/DBIx-Class-Migration/issues/comments/419361656","html_url":"https://github.com/jjn1056/DBIx-Class-Migration/issues/108#issuecomment-419361656","issue_url":"https://api.github.com/repos/jjn1056/DBIx-Class-Migration/issues/108","id":419361656,"node_id":"MDEyOklzc3VlQ29tbWVudDQxOTM2MTY1Ng==","user":{"login":"KES777","id":799021,"node_id":"MDQ6VXNlcjc5OTAyMQ==","avatar_url":"https://avatars1.githubusercontent.com/u/799021?v=4","gravatar_id":"","url":"https://api.github.com/users/KES777","html_url":"https://github.com/KES777","followers_url":"https://api.github.com/users/KES777/followers","following_url":"https://api.github.com/users/KES777/following{/other_user}","gists_url":"https://api.github.com/users/KES777/gists{/gist_id}","starred_url":"https://api.github.com/users/KES777/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KES777/subscriptions","organizations_url":"https://api.github.com/users/KES777/orgs","repos_url":"https://api.github.com/users/KES777/repos","events_url":"https://api.github.com/users/KES777/events{/privacy}","received_events_url":"https://api.github.com/users/KES777/received_events","type":"User","site_admin":false},"created_at":"2018-09-07T08:19:47Z","updated_at":"2018-09-07T08:19:47Z","author_association":"NONE","body":"A few more information on this.\r\n\r\nI set breakpoint at /DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm:500\r\n```\r\n  >>500:   return [SQL::Translator::Diff::schema_diff(\r\n    501:      $source_schema, $db,\r\n    502:      $dest_schema,   $db,\r\n    503:      { producer_args => $sqltargs }\r\n    504:   )];\r\n```\r\nOne interesting fact that same method from same file is different for `$source_schema` VS `$dest_schema`.\r\n\r\n$dest_schema:\r\n```\r\n    ch_saldo => SQL::Translator::Schema::Procedure {\r\n      _ERROR => ,\r\n      comments => [\r\n        ,\r\n      ],\r\n      extra => {\r\n        definitions => [\r\n          {\r\n            language => plpgsql,\r\n          },\r\n          {\r\n            attribute => VOLATILE,\r\n          },\r\n          {\r\n            body =>   /*Ð¢Ð¾Ð»ÑÐºÐ¾ ÑÑÐ¼Ð¼Ð°ÑÐ½ÑÐ¹ ÑÑÑÑ Ð¿Ð¾ ÑÑÑÑÑ*/\r\n  DECLARE _YearFrom  smallint;/**/\r\n  DECLARE _YearTo    smallint;/**/\r\n  DECLARE _MonthFrom smallint;/**/\r\n  DECLARE _MonthTo   smallint;/**/\r\n```\r\n\r\n$source_schema:\r\n```\r\n    ch_saldo => SQL::Translator::Schema::Procedure {\r\n      _ERROR => ,\r\n      comments => [\r\n        ,\r\n      ],\r\n      extra => {\r\n        definitions => [\r\n          {\r\n            language => plpgsql,\r\n          },\r\n          {\r\n            attribute => VOLATILE,\r\n          },\r\n          {\r\n            body =>   /*Только суммарный учёт по счёту*/\r\n  DECLARE _YearFrom  smallint;/**/\r\n  DECLARE _YearTo    smallint;/**/\r\n  DECLARE _MonthFrom smallint;/**/\r\n  DECLARE _MonthTo   smallint;/**/\r\n```\r\n\r\nAs you can see $dest_schema is not UTF8 decoded\r\n\r\nIt is worth to mention that SQL added by `sub sqlt_deploy_hook {` called from `App::Schema` in both cases: for $source and $dest is both decoded correctly.\r\nAll files: `App::Schema` and `::Result` package both have `use utf8`\r\nI use this patch which adds stored procedures: https://github.com/dbsrgits/sql-translator/issues/82"}}
{"actor":{"display_login":"KES777"}}