Issue
My connection is in DB_UNAVAILABLE
and I see in my logs messages that look like:
database unavailable [InvalidDatabaseException]
or
DB is missing Connect metadata [DatabaseValidationFailed]
Why is this happening?
Resolution
Heroku Connect has 3 system tables in every schema that it relies on to operate properly:
_hcmeta
_trigger_log
_trigger_log_archive
These live in the schema next to your mapped objects. If these disappear, you will see the above errors. To verify these tables are missing you can run
\dt <schema>.*
To solve this, you should recreate your connection.