Add app db as audit db on app startup (#30305)
* add column for marking the audit database * create audit db on app startup On app startup, in enterprise mode, always check that there is an up-to-date audit database with is_audit set to true. up-to-date means that it matches the app-db. If the audit db doesnt exist, or doesn't match up with the app-db, it will be created. otherwise no-op - refactor GET /api/database/ into defendpoint * add a few tests * add more tests + return kw for no-op * Merge branch 'master' into bcm-add-app-db-as-audit-db * fix migrations file * lint fix + remove def * keep the old audit db around - nil -> ::no-op * small macro fix * Merge branch 'master' into bcm-add-app-db-as-audit-db * Merge branch 'master' into bcm-add-app-db-as-audit-db * move ensure-db-exists! into its own namespace - avoids circlar dependency on app startup * fix tests * lint fix * inspect test values * use mdb.env/env to initialize audit db * try returning the app-db connection pool - instead of making a doppelganger in metabase database * get the is_audit column when looking up dbs in qp - this key is needed to return the appdb for the "Audit DB"'s connection * clean up audit-db install/update/noop logic * remove audit db from GET api/database/ * Merge branch 'master' of github.com:metabase/metabase into bcm-add-app-db-as-audit-db * fix linter + inline extra function * fix a test * Merge branch 'master' into bcm-add-app-db-as-audit-db * don't test actions on audit db* Revert "don't test actions on audit db " This reverts commit 581ed1ab9495de7b46bccb8b1ab19f66a8fd106d. * for tests to work low IDs are basically reserved - use a higher id when installing audit db * use defenterprise for ensure-audit-db-installed! * Merge branch 'master' into bcm-add-app-db-as-audit-db
Showing
- enterprise/backend/src/metabase_enterprise/audit_db.clj 58 additions, 0 deletionsenterprise/backend/src/metabase_enterprise/audit_db.clj
- enterprise/backend/test/metabase_enterprise/audit_db_test.clj 23 additions, 0 deletions...rprise/backend/test/metabase_enterprise/audit_db_test.clj
- resources/migrations/000_migrations.yaml 16 additions, 0 deletionsresources/migrations/000_migrations.yaml
- src/metabase/api/database.clj 32 additions, 41 deletionssrc/metabase/api/database.clj
- src/metabase/core.clj 8 additions, 0 deletionssrc/metabase/core.clj
- src/metabase/db/env.clj 5 additions, 5 deletionssrc/metabase/db/env.clj
- src/metabase/driver/sql_jdbc/connection.clj 10 additions, 4 deletionssrc/metabase/driver/sql_jdbc/connection.clj
- src/metabase/query_processor/store.clj 2 additions, 1 deletionsrc/metabase/query_processor/store.clj
- test/metabase/api/table_test.clj 2 additions, 1 deletiontest/metabase/api/table_test.clj
Loading
Please register or sign in to comment