Skip to content

Commit

Permalink
Fix readme
Browse files Browse the repository at this point in the history
  • Loading branch information
abogoyavlensky committed Nov 19, 2023
1 parent 65728bc commit ddd0a2d
Showing 1 changed file with 25 additions and 15 deletions.
40 changes: 25 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ Limitations:

### CLI interface

Available commands are: `make`, `migrate`, `list`, `explain`. Let's see them in detail by section.
Available commands are: `make`, `migrate`, `list`, `explain`, `help`. Let's see them in detail by section.

:information_source: *Assume that args `:models-file`, `:migrations-dir` and `:jdbc-url` are supposed to be set in deps.edn alias.*

Expand All @@ -357,7 +357,7 @@ Common args for all commands:
| `:jdbc-url` | Database connection defined as JDBC-url. | `true` (only for `migrate` and `list`) | string jdbc url (example: `"jdbc:postgresql://localhost:5432/mydb?user=myuser&password=secret"`) | *not provided* |
| `:migrations-table` | Model name for storing applied migrations. | `false` | string (example: `"migrations"`) | `"automigrate_migrations"` |

#### `make`
### `make`

Create migration for new changes in models file.
It detects the creating, updating and deleting of tables, columns and indexes.
Expand Down Expand Up @@ -405,7 +405,7 @@ There are no changes in models.
```


#### `migrate`
### `migrate`

Applies change described in migration to database.
Applies all unapplied migrations by number order if arg `:number` is not presented in command.
Expand Down Expand Up @@ -478,7 +478,7 @@ $ clojure -X:migrations migrate :number 10
Invalid target migration number.
```
#### `list`
### `list`
Print out list of existing migrations with statuses displayed as
boxes before migration name:
Expand All @@ -499,7 +499,7 @@ Existing migrations:
[ ] 0003_add_custom_trigger.sql
```
#### `explain`
### `explain`
Print out actual raw SQL for particular migration by number.
Expand Down Expand Up @@ -531,26 +531,36 @@ SQL for migration 0001_auto_create_table_book.edn:
WARNING: backward migration isn't fully implemented yet.
```

#### help/doc
### `help`

You can print docstring for function in the default namespace of the lib by running clojure cli `help/doc` function.
You can print short doc info for a particular command or the tool itself by running `help` command.

Print doc for all available functions:
*Args:*

| Argument | Description | Required? | Possible values | Default value |
|----------|---------------|-----------|-----------------------------------------------|--------------------------------------------------------|
| `:cmd` | Command name. | `false` | `make`, `migrate`, `list`, `explain`, `help` | *not provided*, by default prints doc for all commands |


##### Examples

Print doc for all available commands:

```shell
$ clojure -X:deps:migrations help/doc :ns automigrate.core
Public interface for lib's users.
$ clojure -X:migrations help
Database schema auto-migration tool for Clojure.

-------------------------
Available commands:
...
```

Print doc for particular function:
Print doc for a particular command:

```shell
$ clojure -X:deps:migrations help/doc :ns automigrate.core :fn make
-------------------------
automigrate.core/make
$ clojure -X:migrations help :cmd make
Create a new migration based on changes to the models.

Available options:
...
```

Expand Down

0 comments on commit ddd0a2d

Please sign in to comment.