# Refinery Cli Run Refinery migrations via cli. ## Installation The binary name for `refinery_cli` is `refinery`. **[Archives of precompiled binaries for refinery are available for Windows, macOS and Linux.](https://github.com/rust-db/refinery/releases/)** Linux and Windows binaries are static executables. Users of platforms not explicitly mentioned below are advised to download one of these archives. ### Debian/Ubuntu If you're a **Debian** user (or a user of a Debian derivative like **Ubuntu**), then refinery can be installed using a binary `.deb` file provided in each [refinery_cli release](https://github.com/rust-db/refinery/releases/). ```sh $ curl -LO https://github.com/rust-db/refinery/releases/download/0.8.4/refinery_0.8.4_amd64.deb $ sudo dpkg -i refinery_0.8.4_amd64.deb ``` ### Arch Linux If you're an **Arch Linux** user, then you can install the [`refinery_cli`](https://aur.archlinux.org/packages/refinery_cli) package from AUR: ```sh $ yay refinery_cli ``` ### NixOs If you're a **Nix** user, you can install refinery via the [`refinery-cli`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/refinery-cli/default.nix) package: ```sh $ nix-env -iA refinery-cli ``` ### Cargo. If you're a **Rust programmer**, `refinery_cli` can be installed with `cargo`. ```sh $ cargo install refinery_cli ``` ## Usage Setup your database type and access credentials with `setup`. ```sh $ refinery setup ``` 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`. ```sh $ refinery migrate -c sqlite_refinery.toml -p ./sql_migrations ``` ### Running via database uri 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. ```sh $ refinery migrate -e DB_URI -p ./sql_migrations ``` 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. For more info and migration options run. ```sh $ refinery migrate --help ```