toucan2
toucan2 copied to clipboard
Models with after-update will update twice
(methodical/defmethod t2/table-name :model/Card [_model] :report_card)
(t2/with-call-count [call-count]
(t2/update! :model/Card2 1 {:name "new name 1"})
(call-count))
;; => 1
;; => UPDATE "report_card" SET "name" = ? WHERE "id" = ?
(t2/define-after-update :model/Card2
[card]
card)
(t2/with-call-count [call-count]
(t2/update! :model/Card2 1 {:name "new name 1"})
(call-count))
;; => 3
;; => UPDATE "report_card" SET "name" = ? WHERE "id" = ?
;; => SELECT * FROM "report_card" WHERE "id" IN (?)
;; => UPDATE "report_card" SET "name" = ? WHERE "id" = ?