When you get an email from Heroku that reads:
Your database xxx standard-0 (xxx on scihist-digicoll-production) must undergo maintenance
Schedule 10 minutes of downtime
Put the following in a bash script:
heroku maintenance:on --app scihist-digicoll-production heroku pg:maintenance:run --force --app scihist-digicoll-production heroku pg:wait --app scihist-digicoll-production heroku maintenance:off --app scihist-digicoll-production
At the appointed time, run the script.