|
3 | 3 | Run Refinery migrations via cli.
|
4 | 4 |
|
5 | 5 | ## Installation
|
6 |
| -Install refinery_cli via cargo. |
| 6 | + |
| 7 | +The binary name for `refinery_cli` is `refinery`. |
| 8 | + |
| 9 | +**[Archives of precompiled binaries for refinery are available for Windows, |
| 10 | +macOS and Linux.](https://github.com/rust-db/refinery/releases/)** Linux and |
| 11 | +Windows binaries are static executables. Users of platforms not explicitly |
| 12 | +mentioned below are advised to download one of these archives. |
| 13 | + |
| 14 | +### Debian/Ubuntu |
| 15 | + |
| 16 | +If you're a **Debian** user (or a user of a Debian derivative like **Ubuntu**), |
| 17 | +then ripgrep can be installed using a binary `.deb` file provided in each |
| 18 | +[refinery_cli release](https://github.com/rust-db/refinery/releases/). |
7 | 19 |
|
8 | 20 | ```sh
|
9 |
| -cargo install refinery_cli |
| 21 | +$ curl -LO https://github.com/rust-db/refinery/releases/download/0.8.4/refinery_0.8.4_amd64.deb |
| 22 | +$ sudo dpkg -i refinery_0.8.4_amd64.deb |
| 23 | +``` |
| 24 | + |
| 25 | +### Arch Linux |
| 26 | + |
| 27 | +If you're an **Arch Linux** user, then you can install |
| 28 | +the [`refinery_cli`](https://aur.archlinux.org/packages/refinery_cli) package from AUR: |
| 29 | + |
| 30 | +```sh |
| 31 | +$ yay refinery_cli |
| 32 | +``` |
| 33 | + |
| 34 | +### NixOs |
| 35 | + |
| 36 | +If you're a **Nix** user, you can install ripgrep via |
| 37 | +the [`refinery-cli`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/refinery-cli/default.nix) package: |
| 38 | + |
| 39 | +```sh |
| 40 | +$ nix-env -iA refinery-cli |
| 41 | +``` |
| 42 | + |
| 43 | +### Cargo. |
| 44 | + |
| 45 | +If you're a **Rust programmer**, `refinery_cli` can be installed with `cargo`. |
| 46 | + |
| 47 | + |
| 48 | +```sh |
| 49 | +$ cargo install refinery_cli |
10 | 50 | ```
|
11 | 51 |
|
12 | 52 | ## Usage
|
| 53 | + |
13 | 54 | Setup your database type and access credentials with `setup`.
|
14 | 55 |
|
15 | 56 | ```sh
|
16 |
| -refinery setup |
| 57 | +$ refinery setup |
17 | 58 | ```
|
18 | 59 |
|
19 | 60 | After that, just run your migrations giving your config file with `-c` flag (by defaults it is the `refinery.toml` generated by the setup) and migrations dir with `files -p $dir`.
|
20 | 61 |
|
21 | 62 | ```sh
|
22 |
| -refinery migrate -c sqlite_refinery.toml -p ./sql_migrations |
| 63 | +$ refinery migrate -c sqlite_refinery.toml -p ./sql_migrations |
23 | 64 | ```
|
24 | 65 |
|
25 | 66 | ### Running via database uri
|
26 | 67 |
|
27 | 68 | To run migrations from a database [uri](http://www.postgresql.org/docs/current/static/libpq-connect.html#LIBPQ-CONNSTRING) (like: postgres://user_name:passwd@hostname:5432/myDB ) stored in an environment variable DB_URI.
|
28 | 69 |
|
29 | 70 | ```sh
|
30 |
| -refinery migrate -e DB_URI -p ./sql_migrations |
| 71 | +$ refinery migrate -e DB_URI -p ./sql_migrations |
31 | 72 | ```
|
32 |
| -This option is also useful when running refinery inside a docker container, where you usually have the db connection info stored as an environment variable. |
33 | 73 |
|
| 74 | +This option is also useful when running refinery inside a docker container, where you usually have the db connection info stored as an environment variable. |
34 | 75 |
|
35 | 76 | For more info and migration options run.
|
36 | 77 |
|
37 | 78 | ```sh
|
38 |
| -refinery migrate --help |
| 79 | +$ refinery migrate --help |
39 | 80 | ```
|
0 commit comments