metabase/toucan

Rollbacks in db/transaction

olymk2 opened this issue · 0 comments

@camsaul I have been trying to use transactions with toucan, however I noticed with test my transaction are not being rolled back.

In my case i am running tests and wanting the data to not be committed and just be rolled back at the end, I am using this code.

   (db/transaction
    (jdbc/db-set-rollback-only! (db/connection))
   (db/insert! User :username "test_user" :password "test" :email "test@example.com")
    (f))

Digging into the src i noticed the rollback code was missing, is this intentional or any possibility of support rollback when things fail, I am not sure of the implications of just dropping in the rollback expression into the db/transact wrapper.