<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <p>Hi Guntis,</p>
    <p>This looks to be down to foreign key constraints.&nbsp; As you are
      trying to upgrade from a version of EPrints that is over 12 years
      ago, I cannot know whether this was a known issue at the time or
      just some quirk of running an very old EPrints database schema in
      what may be a rather more recent version of MySQL.&nbsp; <br>
    </p>
    <p>Assuming that you have suitables backups of the database so you
      can roll back if things go wrong, I would recommend temporarily
      adding the following line to perl_lib/EPrints/Database/mysql.pm
      (for EPrints 3.3.16) after line 243:</p>
    <pre class="wp-block-code" aria-describedby="shcb-language-1" data-shcb-language-name="SQL (Structured Query Language)" data-shcb-language-slug="sql"><code class="hljs language-sql"><span class="hljs-keyword">                $self-&gt;do('SET</span> foreign_key_checks = <span class="hljs-number">0</span>;');
</code></pre>
    <div class="moz-cite-prefix">This should allow you to run the
      upgrade script without getting any errors like you previously
      reported.&nbsp; However, once you have hopefully run epadmin upgrade
      successfully you should immediately remove this line from
      mysql.pm.&nbsp; This temporary change should allow the upgrade script
      to tinker with the database schema without having to worry about
      foreign keys constraints being temporarily broken.&nbsp; Hopefully, by
      the time it finishes the database schema will be fully upgraded
      but there will not be any foreign key constraint issues still
      present.<br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">I am not sure whether the issues you
      had from you first run of &quot;epadmin upgrade&quot; will have left the
      database in an inconsistent state, so it may be worth restoring
      the database from a backup be re-running &quot;epadmin upgrade&quot; with
      the change I have suggested to mysql.pm.</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">Let me know how it goes.&nbsp; I may be able
      to help if you still have problems but I have really much worked
      with EPrints prior to 3.2.&nbsp; There may be some veterans on the list
      that may know more about known issues upgrading from 3.1.x to 3.3.</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">Regards</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">David Newman<br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">On 16/01/2021 18:01, Guntis Zelvis via
      Eprints-tech wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:EMEW3|11c839f32612278b4c8482515918fe38x0FI4k14eprints-tech-bounces|ecs.soton.ac.uk|CAEBFXm7s9w2p8kBOxy+sbAhKL3UL_N=PnWuoWgf=-kE51=B2mA@mail.gmail.com">
      <pre class="moz-quote-pre" wrap="">CAUTION: This e-mail originated outside the University of Southampton.

Hello! I am trying to migrate EPrints v3.1.2 to the latest version. As
I understand it is impossible to migrate straight to v3.4.2, so first
I try to install v3.3.16 and upgrade repository to this version, but
there is few errors in output of 'epadmin upgrade REPOID'

Added dataset upload_progress
DBD::mysql::db do failed: Can't create table 'REPOID.#sql-10710_38'
(errno: 150) at /usr/share/eprints/bin/../perl_lib/EPrints/Database.pm
line 3052, &lt;STDIN&gt; line 1.
SQL ERROR (do): ALTER TABLE `subject_name_sortvalue` ADD CONSTRAINT
`subject_name_sortvalue_fk` FOREIGN KEY(`subjectid`) REFERENCES
`subject`(`subjectid`) ON DELETE CASCADE
SQL ERROR (do): Can't create table 'REPOID.#sql-10710_38' (errno: 150) (#1005)

Later there is:

Upgrading dataset file
Upgrading `file` by insertion
DBD::mysql::db do failed: Cannot delete or update a parent row: a
foreign key constraint fails at
/usr/share/eprints/bin/../perl_lib/EPrints/Database.pm line 3052,
&lt;STDIN&gt; line 1.
SQL ERROR (do): DROP TABLE IF EXISTS `old_file`
SQL ERROR (do): Cannot delete or update a parent row: a foreign key
constraint fails (#1217)

Upgrading dataset upload_progress
Upgrading `upload_progress` by insertion
DBD::mysql::db do failed: Cannot delete or update a parent row: a
foreign key constraint fails at
/usr/share/eprints/bin/../perl_lib/EPrints/Database.pm line 3052,
&lt;STDIN&gt; line 1.
SQL ERROR (do): DROP TABLE IF EXISTS `old_upload_progress`
SQL ERROR (do): Cannot delete or update a parent row: a foreign key
constraint fails (#1217)

Upgrading rindex and grep tables for subject
DBD::mysql::st execute failed: Table 'REPOID.subject__rindex' doesn't
exist at /usr/share/eprints/perl_lib/EPrints/Database/mysql.pm line
423, &lt;STDIN&gt; line 1.
DBD::mysql::st fetch failed: fetch() without execute() at
/usr/share/eprints/perl_lib/EPrints/Database/mysql.pm line 426,
&lt;STDIN&gt; line 1.
DBD::mysql::st execute failed: Table 'REPOID.subject__rindex' doesn't
exist at /usr/share/eprints/bin/epadmin line 2769, &lt;STDIN&gt; line 1.
DBD::mysql::st fetch failed: fetch() without execute() at
/usr/share/eprints/bin/epadmin line 2770, &lt;STDIN&gt; line 1.
DBD::mysql::db do failed: Table 'REPOID.subject__rindex' doesn't exist
at /usr/share/eprints/bin/../perl_lib/EPrints/Database.pm line 3052,
&lt;STDIN&gt; line 1.
SQL ERROR (do): ALTER IGNORE TABLE subject__rindex MODIFY field
VARCHAR(64) CHARACTER SET UTF8, MODIFY word VARCHAR(128) CHARACTER SET
UTF8, DEFAULT CHARACTER SET UTF8, ADD PRIMARY
KEY(field,word,`subjectid`)
SQL ERROR (do): Table 'REPOID.subject__rindex' doesn't exist (#1146)

And everything stops here:
Upgrading dataset metafield

------------------------------------------------------------------
---------------- EPrints System Error ----------------------------
------------------------------------------------------------------
An unexpected error occurred while attempting to convert tables to UTF-8.

------------------------------------------------------------------
EPrints System Error inducing stack dump
 at /usr/share/eprints/bin/../perl_lib/EPrints.pm line 147, &lt;STDIN&gt; line 1.
        EPrints::abort() called at /usr/share/eprints/bin/epadmin line 2753
        main::upgrade_mysql_charset('EPrints::Repository=HASH(0xb9fc80)',
'EPrints::Database::mysql=HASH(0x384b458)') called at
/usr/share/eprints/bin/epadmin line 3008
        main::upgrade_3_1_2_to_3_2_0('EPrints::Repository=HASH(0xb9fc80)',
'EPrints::Database::mysql=HASH(0x384b458)') called at
/usr/share/eprints/bin/epadmin line 2887
        main::upgrade('REPOID') called at
/usr/share/eprints/bin/epadmin line 320

How to fix these errors and complete repository upgrade?

*** Options: <a class="moz-txt-link-freetext" href="http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech">http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech</a>
*** Archive: <a class="moz-txt-link-freetext" href="https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&amp;data=04%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Cd7b2ad38ef034e6d49b508d8ba4dd441%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637464190806840276%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=%2BG3cTWy9YFpvK1Q6C1bz%2Fe35BLtvbSIZMGhMjCNoilk%3D&amp;reserved=0" originalSrc="http://www.eprints.org/tech.php/" shash="PpEjtui7GMnVRImFzrcEZaYGb/NRYIffYR01l4L69aSRSMdwYnYJaDlGsLcEllG/F+PDGHTjXMOlKyXsCk+B6R5UEhu9ykH3co7b3m1sPq+IUxeIxpBj4FXQTo6m+wovejhuHFpqMBfE7jIZLuQ55A+siVlOlag/p8ee/T0URoc=">https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&amp;amp;data=04%7C01%7Cdrn%40ecs.soton.ac.uk%7C80641a7b0bb64e32af1808d8ba494561%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637464171151379183%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;amp;sdata=HhJbYby71iR6yf1Dz2kJu5kBgLpM%2BSxmur8JA5VV75Q%3D&amp;amp;reserved=0</a>
*** EPrints community wiki: <a class="moz-txt-link-freetext" href="https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&amp;data=04%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Cd7b2ad38ef034e6d49b508d8ba4dd441%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637464190806840276%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=qQyaDCpOQ%2Fi20q5f%2FRX4Ih8O7Vm2hLikq6D7IxceSxA%3D&amp;reserved=0" originalSrc="http://wiki.eprints.org/" shash="jdns5F9WHALtEOko4dnIimxFBeveNoFHcv8mNlHRBpgnCMVWB5SiZBrUohoQQC9MgmW81JLTWFysBE7yJ7Q4K8udV8wwlteCCMBDVeVy42GzgkZR1JcXZ5O0+EekGESroSYkNB1h1Ur2qBQ2q9FuQhtxzbLyZ1AvrgWkxqTxpog=">https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&amp;amp;data=04%7C01%7Cdrn%40ecs.soton.ac.uk%7C80641a7b0bb64e32af1808d8ba494561%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637464171151379183%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;amp;sdata=RrZj2YwOClqbT8Q8Act3TtVAUim5cof4MzIVMxtHyLo%3D&amp;amp;reserved=0</a>
</pre>
    </blockquote>
  <div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br>
<table style="border-top: 1px solid #D3D4DE;">
        <tr>
        <td style="width: 55px; padding-top: 13px;"><a href="https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.avg.com%2Femail-signature%3Futm_medium%3Demail%26utm_source%3Dlink%26utm_campaign%3Dsig-email%26utm_content%3Demailclient&amp;data=04%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Cd7b2ad38ef034e6d49b508d8ba4dd441%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637464190806850272%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=WZeJks8WI55sRC5YRSsFIuQ5dke0VUJBGXvfAZV7JxM%3D&amp;reserved=0" originalSrc="http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" shash="P3iesHRJ3VSQHxa8/3b4F3E/X22ovS29julz61HyWWtUY+Z/PE3s5lOUWu/P0/akbgrh8xuEiZAd5uy3cIYZ2uId9697bLcO33H0f4EMB3/uCbOk76iFZAzZFQcJb6vzw1Zs5fVWSq7JChkFOiRobP4kDYi8VKtiguxDzuPj/IE=" target="_blank"><img src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-green-avg-v1.png" alt="" width="46" height="29" style="width: 46px; height: 29px;"></a></td>
                <td style="width: 470px; padding-top: 12px; color: #41424e; font-size: 13px; font-family: Arial, Helvetica, sans-serif; line-height: 18px;">Virus-free. <a href="https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.avg.com%2Femail-signature%3Futm_medium%3Demail%26utm_source%3Dlink%26utm_campaign%3Dsig-email%26utm_content%3Demailclient&amp;data=04%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Cd7b2ad38ef034e6d49b508d8ba4dd441%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637464190806850272%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=WZeJks8WI55sRC5YRSsFIuQ5dke0VUJBGXvfAZV7JxM%3D&amp;reserved=0" originalSrc="http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" shash="P3iesHRJ3VSQHxa8/3b4F3E/X22ovS29julz61HyWWtUY+Z/PE3s5lOUWu/P0/akbgrh8xuEiZAd5uy3cIYZ2uId9697bLcO33H0f4EMB3/uCbOk76iFZAzZFQcJb6vzw1Zs5fVWSq7JChkFOiRobP4kDYi8VKtiguxDzuPj/IE=" target="_blank" style="color: #4453ea;">www.avg.com</a>
                </td>
        </tr>
</table><a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"> </a></div></body>
</html>