Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
c3bca15a
Unverified
Commit
c3bca15a
authored
1 year ago
by
bryan
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
dont increment audit db id + remove 1-arity (#35169)
parent
70c8d96c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
enterprise/backend/src/metabase_enterprise/audit_db.clj
+15
-19
15 additions, 19 deletions
enterprise/backend/src/metabase_enterprise/audit_db.clj
with
15 additions
and
19 deletions
enterprise/backend/src/metabase_enterprise/audit_db.clj
+
15
−
19
View file @
c3bca15a
...
...
@@ -97,24 +97,20 @@
(
defn-
install-database!
"Creates the audit db, a clone of the app db used for auditing purposes.
- This uses a weird ID because some tests are hardcoded to look for database with ID = 2, and inserting an extra db
throws that off since the IDs are sequential."
([
engine
]
(
install-database!
engine
perms/audit-db-id
))
([
engine
id
]
(
if
(
t2/select-one
Database
:id
id
)
(
install-database!
engine
(
inc
id
))
(
do
;; guard against someone manually deleting the audit-db entry, but not removing the audit-db permissions.
(
t2/delete!
:permissions
{
:where
[
:like
:object
(
str
"%/db/"
id
"/%"
)]})
(
t2/insert!
Database
{
:is_audit
true
:id
id
:name
"Internal Metabase Database"
:description
"Internal Audit DB used to power metabase analytics."
:engine
engine
:is_full_sync
true
:is_on_demand
false
:creator_id
nil
:auto_run_queries
true
})))))
- This uses a weird ID because some tests were hardcoded to look for database with ID = 2, and inserting an extra db
throws that off since these IDs are sequential."
[
engine
id
]
;; guard against someone manually deleting the audit-db entry, but not removing the audit-db permissions.
(
t2/delete!
:permissions
{
:where
[
:like
:object
(
str
"%/db/"
id
"/%"
)]})
(
t2/insert!
Database
{
:is_audit
true
:id
id
:name
"Internal Metabase Database"
:description
"Internal Audit DB used to power metabase analytics."
:engine
engine
:is_full_sync
true
:is_on_demand
false
:creator_id
nil
:auto_run_queries
true
}))
(
defn-
adjust-audit-db-to-source!
[{
audit-db-id
:id
}]
...
...
@@ -213,7 +209,7 @@
(
nil?
audit-db
)
(
u/prog1
::installed
(
log/info
"Installing Audit DB..."
)
(
install-database!
mdb.env/db-type
))
(
install-database!
mdb.env/db-type
perms/audit-db-id
))
(
not=
mdb.env/db-type
(
:engine
audit-db
))
(
u/prog1
::updated
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment