Package Manager - Error The database migration has failed

Error output - The database migration has failed.

Postgres is outside of Posit support

Postgres is formally outside of support, so it’s best to reach out to your database team to assist with the specifics of this issue.


The following error can occur when attempting to migrate from the default SQLite3 database to Postgres when using Posit Package Manager:

Error: The database migration has failed; do not use the target database: Unable to connect to DB: schema 'metrics' does not exist


Before continuing, please review the Package Manager Using a single database with a separate schema for usage data documentation to verify your configuration.

You can attempt to resolve this issue by:

  • Connecting to your Postgres database using SSH.

  • Next, connect to the target database that Package Manager points to by using the command below (where is the name of the database that you are migrating to):

    \c <databaseName>
  • Create the schema that the error is reporting as missing:

    CREATE SCHEMA metrics;

Once complete, SSH back into the Package Manager server and resume the migration.

  • Stop the Package Manager service:

    sudo systemctl stop rstudio-pm
  • Run the following for the migration:

    sudo /opt/rstudio-pm/bin/migrate database --drop-all

If the problem persists, please open a ticket with support.

Back to top