korma / Korma

Tasty SQL for Clojure.
http://sqlkorma.com
1.48k stars 222 forks source link

Empty "SET" in Update #381

Open bennythomps opened 7 years ago

bennythomps commented 7 years ago

I have this

(println (k/sql-only (k/update db/account (k/set-fields {:name new-name :password new-password}) (k/where {:id (:id current-user-info)}))))

which results in

UPDATE "account" SET  WHERE ("account"."id" = ?)

What am I doing wrong?

enragedginger commented 7 years ago

What's your defentity look like for account?

bennythomps commented 7 years ago

Here it is @enragedginger

(defn fix-email-case [{email :email :as acct}]
  (if email
    (assoc acct :email (str/lower-case email))))

(k/defentity account
  (k/entity-fields :id :email :name :password)
  (k/prepare fix-email-case)
  (k/transform fix-email-case)
  (k/has-many token)
  (k/many-to-many kid :permission))