Permalink
Browse files

Modified complement function to strip sub-elements from create forms.

  • Loading branch information...
budu committed Aug 22, 2011
1 parent e81dd51 commit fe6e7b4fd234262933022a3c08ee4298a3d21055
Showing with 9 additions and 3 deletions.
  1. +9 −3 src/lobos/migration.clj
View
@@ -59,9 +59,15 @@
(defmethod complement
'create
[action]
- (if (= 'schema (-> action reverse first first))
- (concat ['drop] (rest action) [:cascade])
- (apply list 'drop (rest action))))
+ (let [not-cons-or-seq? #(not (or (seq? %)
+ (isa? (type %) clojure.lang.Cons)))
+ args (->> (rest action)
+ (map #(if (seq? %)
+ (filter not-cons-or-seq? %)
+ %)))]
+ (if (= 'schema (-> action reverse first first))
+ (concat ['drop] args [:cascade])
+ (apply list 'drop args))))
(defmethod complement
'alter

0 comments on commit fe6e7b4

Please sign in to comment.