Skip to content

Latest commit

 

History

History
96 lines (76 loc) · 2.26 KB

README.md

File metadata and controls

96 lines (76 loc) · 2.26 KB

seql

migrations for the masses

Build

With leiningen:

git clone https://github.com/it0a/seql && \
cd seql && \
lein bin

Will output a binary at target/seql (Add this to your PATH)

Configuration

seql currently runs under the following heirarchy:

seql
migrations/migrations.clj
migrations/databases.clj

migrations/migrations.clj:

{"0.0.1" ["1.sql"
          "2.sql"]
 "0.0.2" ["1.sql"]}

This defines three files that will run in the following order:

migrations/0.0.1/1.sql
migrations/0.0.1/2.sql
migrations/0.0.2/1.sql

migrations/databases.clj:

{"default" {:classname "com.mysql.jdbc.Driver"
            :subprotocol "mysql"
            :user "root"
            :password "rootpass"
            :host "0.0.0.0"
            :port "3306"
            :databases [{:schema "example"}
                        {:schema "example2"}
                        {:schema "example3"}
                        {:schema "example4"}
                        {:schema "example5"}]}
 "another" {:classname "com.mysql.jdbc.Driver"
            :subprotocol "mysql"
            :user "root"
            :password "rootpass"
            :host "0.0.0.0"
            :port "3306"
            :databases [{:schema   "example6"
                         :user     "anotheruser"
                         :password "anotherpassword"}
                        {:schema "example7"}
                        {:schema "example8"}
                        {:schema "example9"}
                        {:schema "example10"}]}}

Note that :schema "example6" will connect with :user "anotheruser" and :password "anotherpassword". All other :schema will connect with :user "root" and :password "rootpass".

Usage

seql [db-groups...]

With the above databases.clj, we can run all migrations specified in migrations.clj against the 'default' and 'another' groups:

seql default another

TODOs

  • Ability to override same file name, different checksum conflicts
  • Rollback migrations
  • Error handling
  • Leiningen plugin

Wiki

See the project wiki for more details.

License

Copyright © 2015 it0a

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.