When attempting to upgrade your Workbench server, you may see errors such as the below:
[rserver] ERROR Could not update database to latest schema;
[rserver] ERROR database error 1 (Cannot execute query. Fatal error. ERROR: there is no unique constraint matching given keys for referenced table "tablename"
This error typically occurs when you have previously upgraded, then downgraded, and then again attempted to re-upgrade Workbench.
The solution will largely depend on which database you're using.
You can re-generate a new SQLite3 database by removing the old one. Running the command below will back up the database under a new file name, and re-generate the database:
sudo mv /var/lib/rstudio-server/rstudio.sqlite /var/lib/rstudio-server/rstudio.sqlite.backup
There are a number of ways to resolve this in Postgres. The simplest method is to create another database on your Postgres host, and point the Workbench server to the new (empty) database.
Note that you will need to migrate the data from your existing Workbench server to the new database that you've created. Also, you will need to update your postgres connection string to point to the new database in /etc/rstudio/database.conf (or in whichever directory that your config map exists in if using Kubnernetes.) More information on this can be found here:
Another solution is to revert your database to a previous snapshot.
If you still have issues after completing the above, you can always lodge a support ticket, where our group of friendly, and incredibly knowledgeable staff can assist with any issues that you may be having. You can submit a ticket here: