    54 drop-resource-events-resource-type-idx
    55 index-certnames-unique-latest-report-id
    56 merge-fact-values-into-facts
-   57 add-package-inventory})
+   57 add-package-inventory
+   58 add-better-package-inventory-indexing})
 
 (def desired-schema-version (apply max (keys migrations)))
 

    (log/info (trs "Creating additional index `facts_value_string_trgm`"))
    (jdbc/do-commands
     ["create index facts_value_string_trgm on facts"
      "  using gin (value_string gin_trgm_ops)"])))

(defn indexes!
  "Create missing indexes for applicable database platforms."

   "create index package_name_version_idx on package_inventory using btree (name, version)"

   "create index package_certname_idx on package_inventory using btree (certname_id)"))

(defn add-better-package-inventory-indexing []
  (jdbc/do-commands
   "create index package_name_provider_version_idx on package_inventory using btree (name, provider, version)"
   ["create index certnames_inactive_idx on certnames using btree (certname)"
    "  where deactivated is not null or expired is not null"]))

(def migrations
  "The available migrations, as a map from migration version to migration function."
