Perl 6 - the future is here, just unevenly distributed

IRC log for #askriba, 2017-01-09

| Channels | #askriba index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
05:04 dboehmer joined #askriba
09:07 Relequestual joined #askriba
18:26 tcohen joined #askriba
18:29 tcohen hi ribasushi, you told me a couple days ago the column_info keys are not constrained so I did a test adding a description for each column like this:
18:30 tcohen __PACKAGE__->add_columns(
18:30 tcohen "+code" => {
18:30 tcohen koha_description => "Unique key used to identify the attribute type"
18:30 tcohen },
18:30 tcohen question: is there a way to add such column description in a way it gets used in MySQL as a COMMENT ?
18:35 ribasushi tcohen: the answer would be a "cautious yes"
18:35 ribasushi all the bits are there, but I'm not aware of anyone having done so
18:35 ribasushi so what do you need to do is:
18:35 ribasushi hrm... rephrasing
18:36 ribasushi so SQLT + its mysql producer already seem to support comments out of the box:
18:36 ribasushi https://metacpan.org/pod/distribution/SQL-Translator/lib/SQL/Translator/Schema/Field.pm#comments
18:36 ribasushi https://metacpan.org/source/ILMARI/SQL-Translator-0.11021/lib/SQL/Translator/Producer/MySQL.pm#L638-641
18:37 tcohen oh, so it is there
18:37 ribasushi tcohen: ^^ so given that all you need is to decorate the sqlt column objects ( instances of Schema;:Field ) with the correct comments given your metadata
18:38 ribasushi that will have to be done within the DBIC chain of events that takes a tree of schema metadata and translates it to a tree of sqlt metadata
18:38 ribasushi tcohen: the best spot for this would be...
18:38 ribasushi ( looking still )
18:40 ribasushi tcohen: I think the easiest way would be to do it here: https://metacpan.org/pod/DBIx::Class::Schema#sqlt_deploy_hook
18:40 ribasushi so in your ::Schema class you define a sub sqlt_deploy_hook { my ($dbic_schema, $sqlt_schema) = @_; ... }
18:40 ribasushi and in there you "crawl" both trees and decorate the sqlt schema from the info in the dbic one
18:41 ribasushi it's not super-clean, but this is the easiest way to get you going
18:41 tcohen thanks ribasushi
18:41 ribasushi by "super clean" I mean it is a bit cumbersome to iterate over the metadata tree again
18:41 tcohen i'll see how it fits within the koha devs
18:42 ribasushi it is clean in terms of using published interfaces and all that
18:42 ribasushi there are other entry-points into the SQLT object-tree generation, but the one I pointed out to you is the most convenient one given what you are after
18:43 ribasushi tcohen: hope this helps ;)

| Channels | #askriba index | Today | | Search | Google Search | Plain-Text | summary