V5 database migration issues

I am trying to upgrade to v5 of strapi but constantly getting an error during the database migration (I am using postgresql)

current transaction is aborted, commands ignored until end of transaction block

The command before the message above, can be seen on the photo, is always different as a real error that dropped the connection isn’t catched and printed out

Looking into database logs it seems that something is wrong with child-parent connection and it is not able to resolve it, in my schema every category can have one parent and there is no depth limit. Is there some limitation regarding this?

This topic has been created from a Discord post (1287749445911314442) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord

I managed to migrate by editing the migration code and changing batch size to 1. It seems that when using the batches it can’t guarantee order import and then it fails on child-parent relation.
Regarding the con.batchInsert there is a PR for fixing this

That Pr has been merged and should be released tomorrow in 5.0.1

Subject: Strapi Migration Error - Assistance Needed

Hi everyone,

I’m encountering an error while starting my Strapi server after migrating from version 5.0.0-beta2 to 5.0.1. The error message is as follows:

vbnet
Copy code
MigrationError: Migration 5.0.0-05-drop-slug-fields-index (up) failed: Original error: select * from information_schema.tables where table_name = $1 and table_schema = current_schema() - current transaction is aborted, commands ignored until end of transaction block
Could someone assist me with this issue?

Thanks in advance!

The error you see is not the real error that caused transaction drop, so the first step is to check database logs. But if you have data with self reference data that you are probably in the same issue as I was (I fixed it by changing the chunk size to 1 in migration script so it can guarantee the insert order (at least it looked like insert race condition)). If that’s the case we should then create a minimum reproduction and raise an issue on GitHub

100% agreed with what you said Zoran especially with the bug report <a:thumbsupparrot:529293866843504650>

Hello everyone. I got an error during migration. This happens when I run Strapi for the first time after upgrading to version 5. I don’t have a migration script. How can I reduce the chunk size as mentioned above? Or what else can I do to make the migration work?