After upgrading to Nextcloud 31.0.0, I got the following message:

✅ Solution
I fixed the issue by applying the following procedure:
source .env # assumed: contains MYSQL_ROOT_PASSWORD
DBCONTAINER=nextcloud-db #based on your compose.yaml
DBNAME=nextcloud #based on your compose.yaml
docker exec -i $DBCONTAINER mariadb -u root -p$MYSQL_ROOT_PASSWORD -N -e "
SELECT CONCAT('ALTER TABLE ', TABLE_NAME, ' ROW_FORMAT=DYNAMIC;')
FROM information_schema.tables
WHERE table_schema = '$DBNAME' AND ROW_FORMAT != 'Dynamic';" \
| docker exec -i $DBCONTAINER mariadb -u root -p$MYSQL_ROOT_PASSWORD $DBNAME
This worked for me. Hope it helps someone else facing the same issue! 🙌