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
b256862f
Unverified
Commit
b256862f
authored
7 years ago
by
Cam Saul
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #7392 from metabase/upwlabs-hide-deleted-columns
Upwlabs hide deleted columns
parents
cd956bd8
0fb6eb3b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/metabase/models/table.clj
+6
-1
6 additions, 1 deletion
src/metabase/models/table.clj
test/metabase/sync/sync_metadata/fields_test.clj
+13
-5
13 additions, 5 deletions
test/metabase/sync/sync_metadata/fields_test.clj
test/metabase/test/data/h2.clj
+1
-0
1 addition, 0 deletions
test/metabase/test/data/h2.clj
with
20 additions
and
6 deletions
src/metabase/models/table.clj
+
6
−
1
View file @
b256862f
...
...
@@ -62,7 +62,11 @@
(
defn
fields
"Return the `FIELDS` belonging to a single TABLE."
[{
:keys
[
id
]}]
(
db/select
Field,
:table_id
id
:visibility_type
[
:not=
"retired"
]
,
{
:order-by
[[
:position
:asc
]
[
:name
:asc
]]}))
(
db/select
Field
:table_id
id
:active
true
:visibility_type
[
:not=
"retired"
]
{
:order-by
[[
:position
:asc
]
[
:name
:asc
]]}))
(
defn
metrics
"Retrieve the `Metrics` for a single TABLE."
...
...
@@ -127,6 +131,7 @@
(
with-objects
:fields
(
fn
[
table-ids
]
(
db/select
Field
:active
true
:table_id
[
:in
table-ids
]
:visibility_type
[
:not=
"retired"
]
{
:order-by
[[
:position
:asc
]
[
:name
:asc
]]}))
...
...
This diff is collapsed.
Click to expand it.
test/metabase/sync/sync_metadata/fields_test.clj
+
13
−
5
View file @
b256862f
...
...
@@ -14,11 +14,10 @@
[
database
:refer
[
Database
]]
[
field
:refer
[
Field
]]
[
table
:refer
[
Table
]]]
[
metabase.test.data
[
generic-sql
:as
sql-test-data
]
h2
[
interface
:as
tdi
]]
[
toucan.db
:as
db
]
[
metabase.test.data.interface
:as
tdi
]
[
toucan
[
db
:as
db
]
[
hydrate
:refer
[
hydrate
]]]
[
toucan.util.test
:as
tt
]))
(
defn-
with-test-db-before-and-after-dropping-a-column
...
...
@@ -79,6 +78,15 @@
(
db/select
[
Field
:name
:active
]
:table_id
[
:in
(
db/select-ids
Table
:db_id
(
u/get-id
database
))]))))))
;; make sure deleted fields doesn't show up in `:fields` of a table
(
expect
{
:before-drop
#
{
"species"
"example_name"
}
:after-drop
#
{
"species"
}}
(
with-test-db-before-and-after-dropping-a-column
(
fn
[
database
]
(
let
[
table
(
hydrate
(
db/select-one
Table
:db_id
(
u/get-id
database
))
:fields
)]
(
set
(
map
:name
(
:fields
table
)))))))
;; make sure that inactive columns don't end up getting spliced into queries! This test arguably belongs in the query
;; processor tests since it's ultimately checking to make sure columns marked as `:active` = `false` aren't getting
...
...
This diff is collapsed.
Click to expand it.
test/metabase/test/data/h2.clj
+
1
−
0
View file @
b256862f
...
...
@@ -2,6 +2,7 @@
"Code for creating / destroying an H2 database from a `DatabaseDefinition`."
(
:require
[
clojure.string
:as
s
]
[
metabase.db.spec
:as
dbspec
]
metabase.driver.h2
; because we import metabase.driver.h2.H2Driver below
[
metabase.test.data
[
generic-sql
:as
generic
]
[
interface
:as
i
]]
...
...
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