Skip to content

Instantly share code, notes, and snippets.

@cschep
Created June 13, 2015 19:15
Show Gist options
  • Save cschep/466d63f4581653f6a84d to your computer and use it in GitHub Desktop.
Save cschep/466d63f4581653f6a84d to your computer and use it in GitHub Desktop.
;;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