Error upgrading database with remote supplement

Hi,
I am upgrading an OJS 2.4.8 installation to OJS 3.1.1-2. The upgrade chokes on a supplement that has a remote URL

ojs2: DB Error: ERROR:  null value in column "file_id" violates not-null constraint
DETAIL:  Failing row contains (2502, en_US, 2510, null, Data set, 1, http://..., 0).

We did a similar upgrade on the same database a few months ago without problems, and this article was added to the production 2.4.8 database between then and now. There is another file with id 2502 in the submission_files table (a pdf, so should not be related). Not sure if it’s the fact that it’s a remote that’s the problem, or if that’s just a coincidence.

The offending article was added through an import from another installation that we’re trying to merge before the upgrade to OJS3.

Update: Removing the offending supplement solves the issue. I guess something must have gone wrong in the import to 2.4.8?

Simon

Removing the offending supplement allowed us to perform the upgrade without errors, as mentioned in the update above, but now we can’t upload submission galleys to the updated installation, with a similar error

ojs2: DB Error: ERROR:  null value in column "file_id" violates not-null constraint
DETAIL:  Failing row contains (2524, nb_NO, 2551, null, PDF, 0, , 0)., referer: https://.../authorDashboard/submission/2551

Since this is an OJS3 installation it’s a bit strange that the error says “ojs2”, not sure if that’s relevant.

Turns out this is a problem we’ve had before, I just forgot, see my own post from OJS 3.0.2: Can't add galley - #6 by simonmitternacht. Same solution applies.