Liking cljdoc? Tell your friends :D

Clojars Project

Database migrations with Flyway and Revolt

Assuming resources/db/migrations/postgres to be a path where flyway migration files are located.

deps.edn

{:paths ["resources"]
 :aliases {:dev {:extra-deps  {defunkt/revolt {:mvn/version "1.3.0"}
                               defunkt/revolt-flyway-task {:mvn/version "0.1.0"}
                               org.postgresql/postgresql {:mvn/version "42.1.4"}}
                 :main-opts   ["-m" "revolt.bootstrap"]}}}

revolt.edn

:revolt.migrations.task/flyway {:jdbc-url "jdbc:postgresql://localhost:5432/template1"
                                 :locations ["db/migrations/postgres"]
                                 :user "postgres"
                                 :action :info}

using a task with REPL

clj -A:dev -p rebel

(require '[revolt.task :as t])
(require '[revolt.migrations.task :as migrations])
(t/require-task ::migrations/flyway)

;; to see migrations status
(flyway)

;; to apply pending migrations
(flyway {:action :migrate})

;; to clean a schema
(flyway {:action :clean})

using a task from command-line

clj -A:dev -t revolt.migrations.task/flyway

clj -A:dev -t revolt.migrations.task/flyway:action=migrate

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close