Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
;;in example.migration
(defn clean-db [& [force?]]
(if-not force?
(throw (Throwable.
"This is a destructive action! Pass in `force' to make this go through"))
(let [datasource (get-db-datasource)
flyway (doto (Flyway.)
(.setDataSource datasource)
(.setSqlMigrationPrefix ""))]
(.clean flyway))))
;; and a nice alias in the project.clj
:aliases {"migrate" ["run" "-m" "example.migration/migrate"]
"clean" ["run" "-m" "example.migration/clean-db"]})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.