<div dir="ltr">Hi,<div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 28, 2013 at 4:14 AM, Marcel de Rooy <span dir="ltr"><<a href="mailto:M.de.Rooy@rijksmuseum.nl" target="_blank">M.de.Rooy@rijksmuseum.nl</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">





<div lang="NL" link="blue" vlink="purple">
<div>
<p class="MsoNormal">How do we deal with database changes now DBIx::Class is in place?<br></p></div></div></blockquote><div><br></div><div>For the short term (hopefully just the next few weeks), patches can just touch kohastructure.sql and <a href="http://updatedatabase.pl">updatedatabase.pl</a>.  When I push a patch that alters or creates a table, I will take care of running misc/devel/<a href="http://update_dbix_class_files.pl">update_dbix_class_files.pl</a> to do any necessary updates to the DBIC schema classes.</div>
<div><br></div><div>Patch submitters can also include changes generated by <a href="http://update_dbix_class_files.pl">update_dbix_class_files.pl</a> as well, although I prefer that such changes be put in a separate patch in case I need to redo them.</div>
<div><br></div><div>It is a good idea for now to *not* manually change any files under Koha/Schema/Result -- instead, rely on running <a href="http://update_dbix_class_files.pl">update_dbix_class_files.pl</a> on a clean database.  If you do make a change, it should just be for supplement to the code generated by DBIx::Class::Schema::Loader, and should be placed after the following lines in a schema class file:</div>
<div><br></div><div><div># Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-10-14 20:56:21</div><div># DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ZEh31EKBmURMKxDxI+H3EA</div></div><div><br></div><div>One example of this is the Koha/Schema/Result/Issue.pm, where a foreign key relationship that is not yet reflected in the base SQL is noted.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div lang="NL" link="blue" vlink="purple"><div>
<p class="MsoNormal"></p><p class="MsoNormal"><u></u></p>
<p class="MsoNormal">Can we get rid of that redundancy in short time? DBIx::Class should now build a new database instead of kohastructure.. (How exactly btw?)<br></p></div></div></blockquote><div><br></div><div>Once we are ready to switch over to using DBIx::Class to deploy the schema, loading the schema might end up being as simple as running DBIC's deploy() method.  This will require some experimentation, of course.  An alternative would be using DBIC's create_sql_dir method to create SQL scripts.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div lang="NL" link="blue" vlink="purple"><div>
<p class="MsoNormal"></p><p class="MsoNormal"><u></u></p>
<p class="MsoNormal">About the result sets, do we really need to keep track of the same things in two places there (pod line and in add_columns again)?</p></div></div></blockquote><div><br></div><div>The POD and the code are generated by DBIx::Class::Schema::Loader at present, so the redundancy doesn't harm anything.  Once we abandon kohastructure.sql, we can consider taking out the POD from the schema classes, although if we do that, it would be nice if someone were to write something that can spit out schema documentation based on the schema classes.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div lang="NL" link="blue" vlink="purple"><div>

<p class="MsoNormal">If a patch presents a dbrev the old way (with updatedatabase and kohastructure), should we reject it now?</p></div></div></blockquote><div><br></div><div>No.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div lang="NL" link="blue" vlink="purple"><div><p class="MsoNormal">
<u></u><u></u></p>
<p class="MsoNormal">How does the new-style dbrev actually look like in updatedatabase (upgrade part) ? Which call should we make there to DBIx::Class or Koha::Database ?</p></div></div></blockquote><div><br></div><div>This is still be be worked out, but it will probably look something like Koha::Database->upgrade_schema() which will be a wrapper for DBIx::Class::Schema::Versioned.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div lang="NL" link="blue" vlink="purple"><div>
<p class="MsoNormal">
<u></u><u></u></p>
<p class="MsoNormal">Probably calling e.g. add_column in updatedatabase and adding the column in the result class file? Or is there a nicer way to say to DBIx “update my items table” or “sync the whole db structure” (if that does not take too much time) ?</p>
</div></div></blockquote><div><br></div><div>Yes -- DBIx::Class::Schema::Versioned can manage this for us.  Details will need to be worked out, but essentially it will be possible to update the schema class(es), increment a version number, then use an ->upgrade() method to apply the update.</div>
<div><br></div><div>Regards,</div><div><br></div><div>Galen</div></div>-- <br><div dir="ltr"><div>Galen Charlton</div><div>Manager of Implementation</div><div>Equinox Software, Inc. / The Open Source Experts</div><div>email:  <a href="mailto:gmc@esilibrary.com" target="_blank">gmc@esilibrary.com</a></div>
<div>direct: +1 770-709-5581</div><div>cell:   +1 404-984-4366</div><div>skype:  gmcharlt</div><div>web:    <a href="http://www.esilibrary.com/" target="_blank">http://www.esilibrary.com/</a></div><div>Supporting Koha and Evergreen: <a href="http://koha-community.org" target="_blank">http://koha-community.org</a> & <a href="http://evergreen-ils.org" target="_blank">http://evergreen-ils.org</a></div>
</div>
</div></div>