diff --git a/enterprise/backend/src/metabase_enterprise/serialization/cmd.clj b/enterprise/backend/src/metabase_enterprise/serialization/cmd.clj index ec909efd045fc68fe0fc87c81519261bad429c6a..19130a62a0331025bc5f85bd5b3ef8151f7d727e 100644 --- a/enterprise/backend/src/metabase_enterprise/serialization/cmd.clj +++ b/enterprise/backend/src/metabase_enterprise/serialization/cmd.clj @@ -203,15 +203,14 @@ (defn v2-dump "Exports Metabase app data to directory at path" - [path {:keys [user-email collection-ids] :as opts}] + [path {:keys [collection-ids] :as opts}] (log/info (trs "Exporting Metabase to {0}" path) (u/emoji "ðŸ 🚛💨")) (mdb/setup-db!) (check-premium-token!) (t2/select User) ;; TODO -- why??? [editor's note: this comment originally from Cam] (serdes/with-cache (-> (cond-> opts - (seq collection-ids) (assoc :targets (v2.extract/make-targets-of-type "Collection" collection-ids)) - user-email (assoc :user-id (t2/select-one-pk User :email user-email :is_superuser true))) + (seq collection-ids) (assoc :targets (v2.extract/make-targets-of-type "Collection" collection-ids))) v2.extract/extract (v2.storage/store! path))) (log/info (trs "Export to {0} complete!" path) (u/emoji "🚛💨 📦")) diff --git a/src/metabase/cmd.clj b/src/metabase/cmd.clj index 155387d3d64c752aa5e8f8c490804257c6eaf52a..d7e1f276e9e953c946cf3df106131a9897ea90e2 100644 --- a/src/metabase/cmd.clj +++ b/src/metabase/cmd.clj @@ -206,15 +206,9 @@ (defn ^:command export {:doc "Serialize Metabase instance into directory at `path`." - :arg-spec [["-u" "--user EMAIL" "Include collections owned by the specified user" - :id :user-email] - ["-c" "--collection ID" "Export only specified ID; may occur multiple times." - :id :collections - :multi true - :parse-fn #(Integer/parseInt %) - :update-fn (fnil conj [])] - [nil "--collections ID_LIST" "(Legacy-style) Export collections in comma-separated list of IDs, e.g. '123,456'." - :parse-fn (fn [s] (map #(Integer/parseInt %) (str/split s #"\s*,\s*")))] + :arg-spec [["-c" "--collection ID" "Export only specified ID(s). Use commas to separate multiple IDs." + :id :collection-ids + :parse-fn (fn [raw-string] (map parse-long (str/split raw-string #"\s*,\s*")))] ["-C" "--no-collections" "Do not export any content in collections."] ["-S" "--no-settings" "Do not export settings.yaml"] ["-D" "--no-data-model" "Do not export any data model entities; useful for subsequent exports."] diff --git a/test/metabase/cmd_test.clj b/test/metabase/cmd_test.clj index 5ea79bf0cd2e4a64bdb87519ec0d88e136168b31..9288032d06911d38649cc4263a8ef3f85752ecad 100644 --- a/test/metabase/cmd_test.clj +++ b/test/metabase/cmd_test.clj @@ -47,10 +47,14 @@ {} ["--collection" "123"] - {:collections [123]} + {:collection-ids [123]} + + ["-c" "123, 456"] + {:collection-ids [123 456]} + + ["-c" "123,456,789"] + {:collection-ids [123 456 789]} - ["-c" "123" "-c" "456"] - {:collections [123 456]} ["--include-field-values"] {:include-field-values true}