Open Tony-metabase opened 1 month ago
This would be extremely useful for us. In order to embed Metabase dashboards in our Ruby on Rails app with appropriate user access control, we have tightly coupled integration, including managing collections, dashboards, questions, groups, and permissions. We have many automated tests and the setup/teardown process is painful (either time consuming or a lot of work or both), particularly when we have to update the tests because of a Metabase upgrade.
Is your feature request related to a problem? Please describe. The need is for a way to quickly reset the Metabase Application database to a known state before each test.
Describe the solution you'd like The ability to reset the database through an API. Right now we have a "Revision History" for Dashboards in which you can simply click and the Dashboard will revert to a previous state.
The idea would be to have a similar endpoint but to a previous instance state. So that the whole instance gets reverted to a known state before the test.
Describe alternatives you've considered
You can do things manually or use the container/DB commands themself, example:
You could do some bespoke scripting with pg_dump and pg_restore ... So theoretically you can also do
CREATE DATABASE [dbname] TEMPLATE [template db name];
so you could set your "snapshot" database up, then before each test doCREATE DATABASE my_temp_db TEMPLATE my_snapshot;
and set up the app db to use the new db.Another suggestion is you can save a Postgres container in a certain state, so you can configure Metabase and then save the container in that exact moment, and then use that container every single time so you start over, but on the initial state.