3

Using any clojure database/orm library, how can I create an index in a database? I can't seem to find any relevant examples. (I'm most interested in ClojureQL and clojure.java.jdbc, since I'm currently using those).

EDIT: OK, so I figured out a way to do this with clojure.java.jdbc:

(ns foo
  (:require [clojure.java [jdbc :as sql]]))

(sql/with-connection db
  (sql/do-commands
     "CREATE INDEX IF NOT EXISTS my_index ON some_table (a_column)" ))

But I'd really like to know how to do this in ClojureQL.

Rob Lachlan
  • 14,289
  • 5
  • 49
  • 99

2 Answers2

2

IIRC, ClojureQL doesn't have any support for manipulation of database schemas. It's pretty much geared only towards insertion and querying.

Joost Diepenmaat
  • 17,633
  • 3
  • 44
  • 53
2

ClojureQL is meant for generating the Data Manipulation part of SQL, CRUDing data, but not structure. To generate and execute the Data Definition side of SQL under Clojure, have a look at the Lobos library, which is being made to compliment ClojureQL in this regard.

NielsK
  • 6,886
  • 1
  • 24
  • 46