 (defn- delete-collection-sql
   "Generate SQL to delete a collection from a provider's collection table."
   [provider-id collection-id]
-  ;; FIXME - this runs as the metadata db user so it's not necessary to specify the tablespace
-  ;; FIXME - Don't manually create the table names here. This should use shared code from metadata db or something.
-  (let [collection-table (keyword (str metadata-db-tablespace "." provider-id "-collections"))]
+  (let [collection-table (tables/get-table-name provider-id :collection)]
     (su/build (delete collection-table (where `(= :concept-id ~collection-id))))))
 
 (defn- delete-collection

(defn- copy-granule-data-for-collection-sql
  "Generate the SQL to copy the granule data from the catalog reset datbase to the metadata db."
  [provider-id collection-id dataset-record-id]
  (let [granule-echo-table (keyword (str catalog-rest-tablespace "." provider-id "-granule-records"))
        granule-mdb-table (keyword (str metadata-db-tablespace "." provider-id "-granules"))
        sequence (keyword (str metadata-db-tablespace ".concept_id_seq.NEXTVAL"))]
    (su/build (insert granule-mdb-table [:concept-id
                                         :native-id
                                         :parent-collection-id

            [sqlingvo.vendor :as v]
            [cmr.metadata-db.data.oracle.sql-utils :as su]
            [clojure.core.async :as ca :refer [thread alts!! <!!]]
            [cmr.oracle.connection :as oc]
            [cmr.metadata-db.data.oracle.concept-tables :as tables]))

;; To copy a provider
;; 1. Tell the metadata db to drop the provider
