Using the H2 backup to revert a failed Postgres Migration

How can I use the H2 backup to revert a failed Postgres Migration?

If you want to revert the migration, then I’ll assume that your Lenses configuration contains the connection data to Postgres and the storage directory configuration. Inside the storage directory, there may also be the file lensesdb.postgresql.migration. Considering this information, you can execute the following steps:

  • Stop Lenses
  • Comment out the Postgres configurations in the configuration file
  • Check if the lenses.storage.directory parameter in the configuration file is pointing to your H2 storage folder.
  • Delete or rename the “lensesdb.postgresql.migration” file from the storage folder, which indicates that a migration from H2 to Postgres was performed. If you are reverting to H2, you won’t need it.
  • Restart Lenses.

Before executing these steps, check the documentation for more details and to avoid problems, such as trying to revert back to Postgres and not having the “lensesdb.postgresql.migration” file indicating migration, incorrect database credentials, etc. Here is the link: Persistent storage for Lenses | Lenses.io Documentation