Description
Lobos is a library to help you create and modify database schemas using Clojure code. It currently has support for H2, MySQL, PostgreSQL, SQLite and SQL Server.
It is currently being actively developed and its API isn't stable yet. In its present form, it only provide an imperative DSL to generated database specific data definition statements. That is the foundation upon which the migrations and declarative schema features will be built.
Installation
You can use Lobos in your projects using either Leiningen or Cake by adding the following dependency to you project file:
[lobos "0.8.0"]
Lobos is also available through Maven:
<dependency> <groupId>lobos</groupId> <artifactId>lobos</artifactId> <version>0.8.0</version> </dependency>
You can always add the current or previous version manually, consult the downloads page to find the version you want.
Example
Lobos is easy to use, you can try it by creating a new Leiningen project, adding the Lobos dependency as above and another dependency for the database system you want to use. Here's an example using the H2 database:
[com.h2database/h2 "1.3.154"]
Now fire up a REPL and enter the following code:
(use 'lobos.connectivity 'lobos.core 'lobos.schema) (def h2 {:classname "org.h2.Driver" :subprotocol "h2" :subname "./lobos"}) (create h2 (table :users (integer :id :primary-key) (varchar :name 100)))
For a more complete understanding of how to use Lobos refer to the documentation page.