<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hi,</p>
    <p>It seems that you've got in issuingrules table an itemtype that
      does not exists in itemtypes table, so the constraint on
      circulation_rules raises an error when trying to insert it.<br>
    </p>
    <p>SELECT itemtype FROM issuningrules LEFT JOIN itemtypes USING
      (itemtype) WHERE itemtypes.itemtype IS NULL and
      issuingrules.itemtype !='*'</p>
    <p>should give you the faulty records.</p>
    <p>Best regards</p>
    <p>S. Meynieux<br>
    </p>
    <pre class="moz-signature" cols="72">-- Hi,
Responsable support 
BibLibre
+ 33 (0)4 91 81 35 08
<a class="moz-txt-link-freetext" href="http://www.biblibre.com">http://www.biblibre.com</a></pre>
    <div class="moz-cite-prefix">Le 03/11/2020 à 21:48, Philippe Blouin
      a écrit :<br>
    </div>
    <blockquote type="cite"
      cite="mid:bd39d9f3-8ec0-0f79-a0c2-ec4cbba6cc0a@inlibro.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <p>Hello all,</p>
      <p>Simple question: am I interpreting right that '*' itemtypes in
        issuingrules fail to migrate to circulation_rules because of the
        constraint?<br>
      </p>
      <p><tt>DBD::mysql::db do failed: Cannot add or update a child row:
          a foreign key constraint fails (`koha_vingt`.`<span
            style="background-color: yellow;">circulation_rules</span> <span
            style="background-color: white;"></span>`, CONSTRAINT
          `circ_rules_ibfk_3` <span style="background-color: yellow;">FOREIGN
            KEY (`itemtype`)</span> <span style="background-color:
            white;"></span> REFERENCES `itemtypes` (`itemtype`) ON
          DELETE CASCADE ON UPDATE CASCADE) [for Statement "</tt><tt><br>
        </tt><tt>                INSERT INTO circulation_rules (
          categorycode, branchcode, itemtype, rule_name, rule_value )</tt><tt><br>
        </tt><tt>                SELECT IF(categorycode='*', NULL,
          categorycode), IF(branchcode='*', NULL, branchcode), <span
            style="background-color: yellow;">IF(itemtype='*', NULL,
            itemtype)</span> <span style="background-color: white;"></span>,
          'finedays', COALESCE( finedays, '' )</tt><tt><br>
        </tt><tt>                FROM issuingrules</tt><tt><br>
        </tt><tt>            "] at
          ./installer/data/mysql/updatedatabase.pl line 20712.</tt><tt><br>
        </tt></p>
      <p>Migrating that DB can be long, so rather than re-test
        extensively, I figured I'd raise my hand and ask the community
        what I'm getting wrong.  Migration goes from 19.05.04 to
        20.05.04.<br>
      </p>
      <p>Thanks in advance,<br>
      </p>
      <div class="moz-signature">-- <br>
        <style type="text/css">
.moz-signature {
 color: #FFFFFF;
}
.sig_inlibro {
 padding-top : 2px;
 color: #888888;
 font-family : "Trebuchet MS", verdana;
 font-size: 90%;
}
.sig_content {
 border-top: 2px solid #DDDDDD;
 border-bottom: 2px solid #BFD13D;
 background-color : #F6F6F6;
 padding-left:10px;
}
.sig_inlibro a:visited, .sig_inlibro a:hover, .sig_inlibro a:link {
 text-decoration: none;
 color: #005B85;
}
.nom {
 color: #005B85;
 font-weight : bold;
}
.inlibro, .in {
 color: #BFD13D;
}
.libro {
 color: #005B85;
}
.in, .libro {
 font-size : 120%;
}
.desc {
    margin-bottom: 0;
    padding-bottom: 5px;
}
.small {
 font-size: 80%;
}
.tagline {
 color : #00BCE4;
}
.sig_footer {
 padding-left : 10px;
 background-color : #EEEFEA;
}
</style>
        <div class="sig_inlibro">
          <div class="sig_content"> <span class="nom">Philippe Blouin,</span><br>
            <span class="tagline small">Directeur de la technologie</span><br>
            <p class="desc small"> Tél.  : (833) 465-4276, poste 230<br>
              <!--
   Tél.  : (888) 604-2627<br/>
--> <a href="mailto:philippe.blouin@inLibro.com" moz-do-not-send="true">philippe.blouin@inLibro.com</a>
            </p>
          </div>
          <div class="sig_footer"> <span class="in">in</span><span
              class="libro">Libro</span> <span class="tagline small">|
              pour esprit libre |</span> <a class="small"
              href="http://www.inLibro.com" moz-do-not-send="true">www.inLibro.com</a>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Koha-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Koha-devel@lists.koha-community.org">Koha-devel@lists.koha-community.org</a>
<a class="moz-txt-link-freetext" href="https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel">https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel</a>
website : <a class="moz-txt-link-freetext" href="http://www.koha-community.org/">http://www.koha-community.org/</a>
git : <a class="moz-txt-link-freetext" href="http://git.koha-community.org/">http://git.koha-community.org/</a>
bugs : <a class="moz-txt-link-freetext" href="http://bugs.koha-community.org/">http://bugs.koha-community.org/</a>
</pre>
    </blockquote>
  </body>
</html>