How can I add an index to a table using ClojureQL?

374 Views Asked by At

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.

2

There are 2 best solutions below

0
On BEST ANSWER

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.

0
On

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