Fixes #16767: upgrade_unattended script is no longer working.

mantishub.com uses upgrade_unattended to setup instances.  When doing so, I discovered that this script is no longer working and doesn't support constructs in the schema that are supported by the web installer.  This change fixes this issue.  So now the script can be used to upgrade instances.

The script can also be used to install instances in an empty database if the check marked with a TODO is removed.  Hence, the workflow of creating an empty database and then populating it with the schema or upgrading to latest database can be consistent.