diff --git a/src/metabase/sync/sync_metadata/tables.clj b/src/metabase/sync/sync_metadata/tables.clj index 82b640d5b5e8c694b226eb652d1aeafa2a8ac22d..cf0a76e678835aa92052d9119db36bb67aa91e02 100644 --- a/src/metabase/sync/sync_metadata/tables.clj +++ b/src/metabase/sync/sync_metadata/tables.clj @@ -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! diff --git a/test/metabase/sync/sync_metadata/tables_test.clj b/test/metabase/sync/sync_metadata/tables_test.clj index ec60cf983762fe0b7cdeba1da691b442213018fa..7a68b443f1e25fe904f113ee68ab765622168c09 100644 --- a/test/metabase/sync/sync_metadata/tables_test.clj +++ b/test/metabase/sync/sync_metadata/tables_test.clj @@ -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