Delete database using config file (#46437)
== Goal == Currently the config file (`MB_CONFIG_FILE_PATH`) only allows adding or changing databases, but not removing them. Since connected databases can be managed as a service by us, it becomes necessary to delete any information Metabase has about them, including any stored credentials. Since this is a destructive operation with no way to revert (without restoring from a backup), we raise the bar for accidental deletion and require not just a (boolean) flag, but a magic string to be set. == How to test == 1. Configure a database as described in https://www.metabase.com/docs/latest/configuring-metabase/config-file#databases. 2. Start your Metabase instance. 3. Verify the database shows up in the "admin" section and it works. Create a dashboard and questions using the database. 4. Add a `delete: "DELETE_WITH_DEPENDENTS:${name}"` line to your database configuration section. 5. Restart your Metabase instance. 6. Verify the database no longer shows up in the "admin" section. Notice that questions using it are gone, too. References: https://github.com/metabase/harbormaster/issues/5173
Showing
- enterprise/backend/src/metabase_enterprise/advanced_config/file/databases.clj 24 additions, 11 deletions...rc/metabase_enterprise/advanced_config/file/databases.clj
- enterprise/backend/test/metabase_enterprise/advanced_config/file/databases_test.clj 37 additions, 1 deletion...tabase_enterprise/advanced_config/file/databases_test.clj
Please register or sign in to comment