Sometimes the database migration can failed during upgrades due to database privileges or due to database migration files missing during upgrade. Note that the migration files (available in /database/upgrade/{VERSION}/ folder) missing is possible when you don't put your website under maintenance before starting the upgrade process.
Consider that your website is running on the version 1.0.0 that is the current version of the application, and we release a new version 1.0.1. If after you have upgraded your website to the version 1.0.1, you facing database issues, so you have to follow these step to solve that issue:
Make sure that your database user have full privileges to manage the database on the database host.
Clear the cache from the Admin panel
Put your website under maintenance from the Admin panel
Decrement (Downgrade) your APP_VERSION= in the /.env file to the last old version (in our example: 1.0.0) like below:
APP_VERSION=1.0.0Run the upgrade again by visiting the upgrade URL (domain.tld/upgrade).
Done.