Skip to content
Snippets Groups Projects
Unverified Commit 4445c9e1 authored by Noah Moss's avatar Noah Moss Committed by GitHub
Browse files

Automatically set initial sync status of crufty tables to `complete` (#25945)

* set initial sync status of crufty tables to complete automatically

* fix test
parent ef01bbdf
No related branches found
No related tags found
No related merge requests found
......@@ -110,14 +110,16 @@
(db/update! Table existing-id
:active true)
;; otherwise create a new Table
(db/insert! Table
:db_id (u/the-id database)
:schema schema
:name table-name
:display_name (humanization/name->human-readable-name table-name)
:active true
:visibility_type (when (is-crufty-table? table)
:cruft)))))
(let [is-crufty? (is-crufty-table? table)]
(db/insert! Table
:db_id (u/the-id database)
:schema schema
:name table-name
:display_name (humanization/name->human-readable-name table-name)
:active true
:visibility_type (when is-crufty? :cruft)
;; if this is a crufty table, mark initial sync as complete since we'll skip the subsequent sync steps
:initial_sync_status (if is-crufty? "complete" "incomplete"))))))
(s/defn ^:private retire-tables!
......
......@@ -25,9 +25,9 @@
(deftest crufty-tables-test
(testing "south_migrationhistory, being a CRUFTY table, should still be synced, but marked as such"
(mt/dataset metabase.sync.sync-metadata.tables-test/db-with-some-cruft
(is (= #{{:name "SOUTH_MIGRATIONHISTORY", :visibility_type :cruft}
{:name "ACQUIRED_TOUCANS", :visibility_type nil}}
(set (for [table (db/select [Table :name :visibility_type], :db_id (mt/id))]
(is (= #{{:name "SOUTH_MIGRATIONHISTORY", :visibility_type :cruft, :initial_sync_status "complete"}
{:name "ACQUIRED_TOUCANS", :visibility_type nil, :initial_sync_status "complete"}}
(set (for [table (db/select [Table :name :visibility_type :initial_sync_status], :db_id (mt/id))]
(into {} table))))))))
(deftest retire-tables-test
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment