budu/lobos — Issue #36: Got example when rename column
Author: sunng87
Created: 2012-02-27 08:28:50+00:00
State: open

I'm not sure if I used it correctly because I didn't find code example for this action. My migration is :

```clojure
(defmigration add-user-table
(up []
(create
(table :kusers (integer :id :primary-key :auto-inc)
(varchar :email 100 :unique)
(timestamp :next-update)))
(index :kusers [:email])
(index :kusers [:next-update]))
(down []
(drop (table :kusers))))

(defmigration rename-user-table-timestamp
(up []
(alter
(table :kusers
(column :next-update :to :last-update))))
(down []
(alter
(table :kusers
(column :last-update :to :next-update)))))

```

The create action goes right. But I got exception in the second action:

```
rename-user-table-timestamp
Exception in thread "main" java.lang.IllegalArgumentException: No implementation of method: :build-alter-statement of protocol: #'lobos.schema/Alterable found for class: nil
at clojure.core$_cache_protocol_fn.invoke(core_deftype.clj:495)
at lobos.schema$eval980$fn__981$G__971__990.invoke(schema.clj:40)
at lobos.core$alter_STAR_.doInvoke(core.clj:138)
at clojure.lang.RestFn.invoke(RestFn.java:423)
at lobos.migrations$reify__2337.up(migrations.clj:36)
at lobos.migration$do_migrations.doInvoke(migration.clj:249)
at clojure.lang.RestFn.invoke(RestFn.java:470)
at lobos.core$migrate.doInvoke(core.clj:197)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at user$eval2207.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:6465)
at clojure.lang.Compiler.eval(Compiler.java:6455)
at clojure.lang.Compiler.eval(Compiler.java:6431)
at clojure.core$eval.invoke(core.clj:2795)
at clojure.main$eval_opt.invoke(main.clj:296)
at clojure.main$initialize.invoke(main.clj:315)
at clojure.main$null_opt.invoke(main.clj:348)
at clojure.main$main.doInvoke(main.clj:426)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:405)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:518)
at clojure.main.main(main.java:37)
```

Anyway, would you please add example for renaming column to your document ? It's a common action and the DSL is difficult to guess :)