Skip to content
Snippets Groups Projects
Unverified Commit 8495aada authored by Cam Saul's avatar Cam Saul
Browse files

Print warning when running with H2

parent 1a9db043
Branches
Tags
No related merge requests found
......@@ -154,10 +154,7 @@
[lein-bikeshed "0.4.1"] ; Linting
[lein-check-namespace-decls "1.0.1"] ; lints namespace declarations
[lein-environ "1.1.0"] ; easy access to environment variables
[lein-expectations "0.0.8"] ; run unit tests with 'lein expectations'
;; TODO - should this be moved to the new RING profile?
[lein-ring "0.12.5" ; start the HTTP server with 'lein ring server'
:exclusions [org.clojure/clojure]]]
[lein-expectations "0.0.8"]] ; run unit tests with 'lein expectations'
:env {:mb-run-mode "dev"}
:jvm-opts ["-Dlogfile.path=target/log"]
......@@ -183,7 +180,9 @@
[:exclude-tests {}]
:ring
[:exclude-tests {}]
[:exclude-tests
{:dependencies
[[lein-ring "0.12.5" :exclusions [org.clojure/clojure]]]}] ; start the HTTP server with 'lein ring server'
:with-include-drivers-middleware
{:plugins
......
......@@ -89,25 +89,34 @@
(or (:type @connection-string-details)
(config/config-kw :mb-db-type)))
(def db-connection-details
(def ^:private db-connection-details
"Connection details that can be used when pretending the Metabase DB is itself a `Database` (e.g., to use the Generic
SQL driver functions on the Metabase DB itself)."
(delay (or @connection-string-details
(case (db-type)
:h2 {:type :h2 ; TODO - we probably don't need to specifc `:type` here since we can just call (db-type)
:db @db-file}
:mysql {:type :mysql
:host (config/config-str :mb-db-host)
:port (config/config-int :mb-db-port)
:dbname (config/config-str :mb-db-dbname)
:user (config/config-str :mb-db-user)
:password (config/config-str :mb-db-pass)}
:postgres {:type :postgres
:host (config/config-str :mb-db-host)
:port (config/config-int :mb-db-port)
:dbname (config/config-str :mb-db-dbname)
:user (config/config-str :mb-db-user)
:password (config/config-str :mb-db-pass)}))))
(delay
(when (= (db-type) :h2)
(log/warn
(u/format-color 'red
(str
(trs "WARNING: Using Metabase with an H2 application database is not recomended for production deployments.")
(trs "For production deployments, we highly recommend using Postgres, MySQL, or MariaDB instead.")
(trs "If you decide to continue to use H2, please be sure to back up the database file regularly.")
(trs "See https://metabase.com/docs/latest/operations-guide/start.html#migrating-from-using-the-h2-database-to-mysql-or-postgres for more information.")))))
(or @connection-string-details
(case (db-type)
:h2 {:type :h2 ; TODO - we probably don't need to specifc `:type` here since we can just call (db-type)
:db @db-file}
:mysql {:type :mysql
:host (config/config-str :mb-db-host)
:port (config/config-int :mb-db-port)
:dbname (config/config-str :mb-db-dbname)
:user (config/config-str :mb-db-user)
:password (config/config-str :mb-db-pass)}
:postgres {:type :postgres
:host (config/config-str :mb-db-host)
:port (config/config-int :mb-db-port)
:dbname (config/config-str :mb-db-dbname)
:user (config/config-str :mb-db-user)
:password (config/config-str :mb-db-pass)}))))
(defn jdbc-details
"Takes our own MB details map and formats them properly for connection details for JDBC."
......
(ns metabase.sync.analyze.fingerprint.insights-test
(:require [expectations :refer :all]
[metabase.sync.analyze.fingerprint.insights :refer :all :as i]))
[metabase.sync.analyze.fingerprint.insights :as i :refer :all]))
(def ^:private cols [{:base_type :type/DateTime} {:base_type :type/Number}])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment