Skip to content

Instantly share code, notes, and snippets.

@cschep
Created June 13, 2015 19:15
Show Gist options
  • Select an option

  • Save cschep/466d63f4581653f6a84d to your computer and use it in GitHub Desktop.

Select an option

Save cschep/466d63f4581653f6a84d to your computer and use it in GitHub Desktop.

Revisions

  1. cschep created this gist Jun 13, 2015.
    14 changes: 14 additions & 0 deletions gistfile1.clj
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    ;;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"]})