Hi there, I just posted about my experience with LDAP after a major upgrade. Maybe it will help: Solutions to problems with LDAP table in SQL DB after upgrade
The main thing I found useful was to do
occ db:schema:expected > expected.txt
occ db:schema:export > actual.txt
…in order to get the current and expected DB layout, so I could adjust the DB to match what was needed.
I also did a fresh install of NC and did an SQL dump immediately after in order to get the correct table layout in SQL command form:
mysqldump \
--single-transaction \
--default-character-set=utf8mb4 \
--no-data \
-u root nextcloud \
| tail +2 > "nc_db_layout.sql"
You can open the resulting file as text and copy the commands that built the tables you find don’t match what is expected.
Hope that helps.