embedded-postgres icon indicating copy to clipboard operation
embedded-postgres copied to clipboard

Return an error instead of deleting data on upgrade

Open kylecarbs opened this issue 3 years ago • 1 comments

When upgrading the version of PostgreSQL, all data was deleted. This seems like undesired user behavior because there's not a clear warning message that everything will be reset.

https://github.com/fergusstrange/embedded-postgres/blob/7bf3aab2dca3964165ded64585e2516791c88876/embedded_postgres.go#L112-L118

I think returning an error due to a data version mismatch PostgreSQL won't start is more expected, and causes less risk of users just losing all of their data.

kylecarbs avatar Aug 10 '22 17:08 kylecarbs

Hi @kylecarbs this tool is really intended for testing and was built from the ground up with that at the heart of the core design.

Initially we needed a "clean" instance of Postgres per test, which is generally good practice when testing so that your tests run in isolation.

For this reason we wouldn't really want to return an error, unless perhaps it was configured to do so.

What is your use case?

fergusstrange avatar Aug 16 '22 00:08 fergusstrange

I would be interested in using this project to store state for a wails app (https://github.com/wailsapp/wails). @fergusstrange , would you advise against this?

ljmatkins avatar Sep 17 '22 14:09 ljmatkins

@fergusstrange we're currently using embedded-postgres as a way for easy installations with Coder, which should work in production-like settings for small deployments.

Installing PostgreSQL just to try software is a pain, so we've used this lib to make the process simpler for our users.

kylecarbs avatar Sep 18 '22 20:09 kylecarbs

@ljmatkins yes this is primarily written for testing.

fergusstrange avatar Sep 21 '22 09:09 fergusstrange