Hi Matt,

working with this stuff... pretty sure I can make rake obsolete pretty soon :)

However I am struggling with the auto increment column attribute...

(create-table
  :meta-entities
  (integer :id {:not-null true :auto-increment true :primary-key true})
  (string :name {:not-null true :unique true })
  (date-time :created_at)
  (date-time :updated_at))

which looks to me compliant with what your code does in the mysql flavor lib.

It yields in MySql:

CREATE TABLE meta_entities  ( 
    id          int(11) NOT NULL,
    name        varchar(255) NOT NULL,
    created_at  datetime NULL,
    updated_at  datetime NULL,
    PRIMARY KEY(id)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0

According to the AquaStudio tool I use to reverse engineer the DDL.

The trace message:

DEBUG                   Thread-51 20111128 234732,063 drift-db-mysql.flavor ] 
Create table: :meta-entities with specs: ({:not-null true, :primary-key true, 
:spec-type :column, :type :integer, :name :id} {:not-null true, :spec-type 
:column, :type :string, :name :name} {:spec-type :column, :type :date-time, 
:name :created_at} {:spec-type :column, :type :date-time, :name :updated_at})

Looks like the :auto-increment is dropped. drift_db/core.clj at line 155 is not 
selecting
it as a potential attribute of an integer field.

I'll patch it locally so I can continue to play with it.

Any reason why the id type does not accept optional attributes ? I use id auto 
incremented keys
everywhere :)

Thank you,

Luc

On Thu, 24 Nov 2011 14:58:43 -0800 (PST)
Matt <macourt...@gmail.com> wrote:

> Drift DB is a clojure database library focused on migration functions.
> 
> With Drift DB you can create tables, drop tables, add columns to
> tables, remove columns from tables, query tables, and, though it is
> not the focus of Drift DB, you can insert, update, delete and select
> rows from tables.
> 
> The only databases currently supported are H2 and Mysql. However,
> Drift DB uses a protocol to abstract out database specific code. All
> you would have to do to support other databases is implement the Drift
> DB protocol for it.
> 
> Drift DB, like Drift, was originally a part of Conjure. However, I had
> several requests to separate out the function into their own library.
> 
> Drift DB is not supposed to be a replacement for ClojureQL or Korma.
> Instead, Drift DB is focused on table altering and other tasks usually
> done in Drift migrations. Such tasks are currently not well supported
> in any other Clojure database library.
> 
> All of the code for Drift DB can be found on github at:
> http://github.com/macourtney/drift-db
> 
> Drift DB on Clojars:
> 
> Drift DB Core: http://clojars.org/org.drift-db/drift-db
> Drift DB H2: http://clojars.org/org.drift-db/drift-db-h2
> Drift DB Mysql: http://clojars.org/org.drift-db/drift-db-mysql
> 



-- 
Luc P.

================
The rabid Muppet

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to