Skip to content

Instantly share code, notes, and snippets.

@bhagany
Created August 31, 2016 16:45
Show Gist options
  • Save bhagany/391766d0b8b0fafabe3aba5929f3a2ce to your computer and use it in GitHub Desktop.
Save bhagany/391766d0b8b0fafabe3aba5929f3a2ce to your computer and use it in GitHub Desktop.
(defn undo-migration-data
[edit-migration with-migration-db undo tx-id store-id version-id]
(let [undo-tx (-> undo :design.undo/tx :db/id)
original-undo-tx (or (-> undo
:design.migration/original-tx
:db/id)
undo-tx)
undo-migration (migration-fn (d/as-of db original-undo-tx)
tx-id
version-id)
old-migration (if-let [data (:design.migration/data undo)]
(read-string data)
[])
undo-str (migration-past-str old-migration
undo-migration
with-migration-db
undo-tx
store-id
version-id)]
[{:db/id (:db/id undo)
:design.undo/tx tx-id
:design.migration/data undo-str
:design.migration/original-tx original-undo-tx}]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment