Skip to content
Snippets Groups Projects
Commit d40a2ca0 authored by Cam Saül's avatar Cam Saül
Browse files

Merge pull request #1682 from metabase/fix-mongo-duplicate-tables

Fix duplicate tables when syncing DB w/o schemas
parents c1b3ee97 b9dbfb21
No related branches found
No related tags found
No related merge requests found
Source diff could not be displayed: it is too large. Options to address this: view the blob.
......@@ -60,7 +60,9 @@
(defn- create-new-tables!
"Create new `Tables` as needed. These are ones that came back from `active-tables` but don't already exist in the DB."
[database active-tables existing-table->id]
(let [existing-tables (set (keys existing-table->id))
(let [active-tables (set (for [table active-tables]
(update table :schema identity))) ; convert tables that come back like {:name ...} to {:name ..., :schema nil}
existing-tables (set (keys existing-table->id))
new-tables (set/difference active-tables existing-tables)]
(when (seq new-tables)
(log/debug (u/format-color 'blue "Found new tables: %s" (vec (for [{table :name, schema :schema} new-tables]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment