                                  (where {:head_name head-name
                                          :tentacle_name tentacle-name}))]
     (if (empty? existing-mapping)
-      (insert head-tentacle-mappings
-              (values {:head-name head-name :tentacle-name tentacle-name})))))
+      (do
+        (log/info "Creating mapping from head" head-name "to tentacle" tentacle-name)
+        (insert head-tentacle-mappings
+                (values {:head-name head-name :tentacle-name tentacle-name})))
+      (log/info "Mapping from" head-name "to" tentacle-name "already exists"))))
+
+(defn remove-mapping!
+  [head tentacle]
+  (log/warn "Removing mapping between head" (:name head) "and tentacle" (:name tentacle))
+  (delete head-tentacle-mappings
+          (where {:head-name (:name head)
+                  :tentacle-name (:name tentacle)})))
 
 (defn get-all-mappings
   []

(ns doctopus.db
  (:require [korma.db :refer [defdb postgres]]
            [clojure.string :as string :refer [split-lines]]
            [korma.core :refer :all]
            [clj-time.coerce :refer [to-sql-time]]
            [clj-time.core :as clj-time]
            [camel-snake-kebab.core :refer [->snake_case_keyword ->kebab-case-keyword]]
            [camel-snake-kebab.extras :refer [transform-keys]]
            [doctopus.configuration :refer [server-config]]))

(defn- now
  []


(defn save-head!
  [head]
  (log/info "Saving head:" head)
  (insert heads
          (values head)))

(defn update-head!
  [head]
  (log/info "Updating head" (:name head) "with values" head)
  (update heads
          (set-fields head)
          (where {:name (:name head)})))

(defn delete-head!
  [head]
  (log/warn "Deleting head" head "!")
  (delete heads
          (where {:name (:name head)})))

