Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c4ec6ac

Browse files
committed
move CLI usage in own README
1 parent cfe3d2a commit c4ec6ac

File tree

2 files changed

+48
-30
lines changed

2 files changed

+48
-30
lines changed

README.md

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -46,38 +46,13 @@ is easy. Just implement the [source/driver interface](source/driver.go).
4646

4747
## CLI usage
4848

49+
__[CLI Documentation](cli/README.md)__
50+
51+
52+
Example:
53+
4954
```
50-
# dowload, build and install the CLI tool
51-
# -tags takes database and source drivers and will only build those
52-
$ go get -u -tags 'postgres' -o migrate github.com/mattes/migrate/cli
53-
54-
$ migrate -help
55-
Usage: migrate OPTIONS COMMAND [arg...]
56-
migrate [ -version | -help ]
57-
58-
Options:
59-
-source Location of the migrations (driver://url)
60-
-path Shorthand for -source=file://path
61-
-database Run migrations against this database (driver://url)
62-
-prefetch N Number of migrations to load in advance before executing (default 10)
63-
-verbose Print verbose logging
64-
-version Print version
65-
-help Print usage
66-
67-
Commands:
68-
goto V Migrate to version V
69-
up [N] Apply all or N up migrations
70-
down [N] Apply all or N down migrations
71-
drop Drop everyting inside database
72-
version Print current migration version
73-
74-
75-
# so let's say you want to run the first two migrations
7655
migrate -database postgres://localhost:5432/database up 2
77-
78-
# if your migrations are hosted on github
79-
migrate -source github://mattes:personal-access-token@mattes/migrate_test \
80-
-database postgres://localhost:5432/database down 2
8156
```
8257

8358

cli/README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# CLI
2+
3+
## Installation
4+
5+
```
6+
# dowload, build and install the CLI tool
7+
# -tags takes database and source drivers and will only build those
8+
$ go get -u -tags 'postgres' -o migrate github.com/mattes/migrate/cli
9+
```
10+
11+
12+
## Usage
13+
14+
```
15+
$ migrate -help
16+
Usage: migrate OPTIONS COMMAND [arg...]
17+
migrate [ -version | -help ]
18+
19+
Options:
20+
-source Location of the migrations (driver://url)
21+
-path Shorthand for -source=file://path
22+
-database Run migrations against this database (driver://url)
23+
-prefetch N Number of migrations to load in advance before executing (default 10)
24+
-verbose Print verbose logging
25+
-version Print version
26+
-help Print usage
27+
28+
Commands:
29+
goto V Migrate to version V
30+
up [N] Apply all or N up migrations
31+
down [N] Apply all or N down migrations
32+
drop Drop everyting inside database
33+
version Print current migration version
34+
35+
36+
# so let's say you want to run the first two migrations
37+
migrate -database postgres://localhost:5432/database up 2
38+
39+
# if your migrations are hosted on github
40+
migrate -source github://mattes:personal-access-token@mattes/migrate_test \
41+
-database postgres://localhost:5432/database down 2
42+
```
43+

0 commit comments

Comments
 (0)