Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Add start-db client commands for mongo and sqlserver. (#82674)

technomancydd48119ea8cc
diff --git a/mage/src/mage/start_db.clj b/mage/src/mage/start_db.clj
index 11540f2c1b2..ebd364c9c1c 100644
--- a/mage/src/mage/start_db.clj
+++ b/mage/src/mage/start_db.clj
@@ -171,11 +171,10 @@
{:arglists '([db port])}
(fn [db _port] db))
-;; TODO: add other databases' commands here
(defmethod client-cmd :default [_ _] nil)
(defmethod client-cmd :mysql [_ port]
- (format "mysql --host localhost --port %s --user root --password=\"\" metabase_test" port))
+ (format "mysql --host 127.0.0.1 --port %s --user root --password=\"\" metabase_test" port))
(defmethod client-cmd :mariadb [_ port]
(client-cmd :mysql port))
@@ -183,6 +182,14 @@
(defmethod client-cmd :postgres [_ port]
(format "PGPASSWORD=password psql --user metabase --host localhost --port %s -d metabase" port))
+(defmethod client-cmd :mongo [_ port]
+ (format "mongosh --host localhost --port %s -u metabase -p metasample123 --authenticationDatabase admin" port))
+
+(defmethod client-cmd :sqlserver [_ port]
+ (format "sqlcmd -S 127.0.0.1,%s -U SA -P 'P@ssw0rd' -C" port))
+
+;; Oracle service names differ between the Free and XE images, so it's more complicated
+
(defn- app-db? [db]
(contains? #{:postgres :mysql :mariadb} db))
@@ -202,7 +209,7 @@
(println (str " clj -M:dev:ee:ee-dev" deps-edn-alias))
(u/debug (str " clj -M:dev:ee:ee-dev" deps-edn-alias " -e '(dev) (start!)'"))))
(when-let [client-command (client-cmd database port)]
- (println "\nUse this command to connect:")
+ (println "\nUse this command to connect: (once the server has started)")
(println client-command))))
(defn- usage