Skip to content

Commit

Permalink
move CLI usage in own README
Browse files Browse the repository at this point in the history
  • Loading branch information
mattes committed Feb 10, 2017
1 parent cfe3d2a commit c4ec6ac
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 30 deletions.
35 changes: 5 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,38 +46,13 @@ is easy. Just implement the [source/driver interface](source/driver.go).

## CLI usage

__[CLI Documentation](cli/README.md)__


Example:

```
# dowload, build and install the CLI tool
# -tags takes database and source drivers and will only build those
$ go get -u -tags 'postgres' -o migrate github.com/mattes/migrate/cli
$ migrate -help
Usage: migrate OPTIONS COMMAND [arg...]
migrate [ -version | -help ]
Options:
-source Location of the migrations (driver://url)
-path Shorthand for -source=file://path
-database Run migrations against this database (driver://url)
-prefetch N Number of migrations to load in advance before executing (default 10)
-verbose Print verbose logging
-version Print version
-help Print usage
Commands:
goto V Migrate to version V
up [N] Apply all or N up migrations
down [N] Apply all or N down migrations
drop Drop everyting inside database
version Print current migration version
# so let's say you want to run the first two migrations
migrate -database postgres://localhost:5432/database up 2
# if your migrations are hosted on github
migrate -source github://mattes:personal-access-token@mattes/migrate_test \
-database postgres://localhost:5432/database down 2
```


Expand Down
43 changes: 43 additions & 0 deletions cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# CLI

## Installation

```
# dowload, build and install the CLI tool
# -tags takes database and source drivers and will only build those
$ go get -u -tags 'postgres' -o migrate github.com/mattes/migrate/cli
```


## Usage

```
$ migrate -help
Usage: migrate OPTIONS COMMAND [arg...]
migrate [ -version | -help ]
Options:
-source Location of the migrations (driver://url)
-path Shorthand for -source=file://path
-database Run migrations against this database (driver://url)
-prefetch N Number of migrations to load in advance before executing (default 10)
-verbose Print verbose logging
-version Print version
-help Print usage
Commands:
goto V Migrate to version V
up [N] Apply all or N up migrations
down [N] Apply all or N down migrations
drop Drop everyting inside database
version Print current migration version
# so let's say you want to run the first two migrations
migrate -database postgres://localhost:5432/database up 2
# if your migrations are hosted on github
migrate -source github://mattes:personal-access-token@mattes/migrate_test \
-database postgres://localhost:5432/database down 2
```

0 comments on commit c4ec6ac

Please sign in to comment.