migra/README.md

70 lines
1.9 KiB
Markdown
Raw Permalink Normal View History

2021-02-08 07:41:52 +03:00
# Migra
2021-02-21 18:22:00 +03:00
[![CI](https://github.com/pleshevskiy/migra/actions/workflows/rust.yml/badge.svg?branch=main)](https://github.com/pleshevskiy/migra/actions/workflows/rust.yml)
[![unsafe forbidden](https://img.shields.io/badge/unsafe-forbidden-success.svg)](https://github.com/rust-secure-code/safety-dance/)
2021-02-25 12:39:40 +03:00
[![Crates.io](https://img.shields.io/crates/v/migra-cli)](https://crates.io/crates/migra-cli)
![Crates.io](https://img.shields.io/crates/l/migra-cli)
2021-02-21 18:22:00 +03:00
2021-02-08 07:41:52 +03:00
Simple SQL migration manager for your project.
### Install
```bash
2021-02-22 12:22:00 +03:00
cargo install migra-cli
2021-02-08 07:41:52 +03:00
```
2021-03-26 02:22:29 +03:00
If you want to use dotenv for configure migra cli, just run the following in your terminal.
2021-03-02 00:53:56 +03:00
```bash
cargo install migra-cli --features dotenv
```
2021-03-26 02:22:29 +03:00
Each supported database is located in separate features with a similar name.
The default is `postgres`.
For example, if you only want to work with `mysql`, you need to disable `postgres` and enable `mysql`.
```bash
cargo install migra-cli --no-default-features --features mysql
```
2021-02-08 07:41:52 +03:00
### Usage
A few steps to get you started
1. Initialize migra configuration (Optional)
```bash
migra init
```
2. Make your first migration
```bash
migra make initial_migration
```
3. Check applied and pending migrations
```bash
migra ls
```
4. Upgrade your database
```bash
migra up
```
For more information about the commands, simply run `migra help`
### Supported databases
2021-05-23 13:33:12 +03:00
| Database | Feature | Default |
|----------|--------------|:------------------:|
| Postgres | postgres | :heavy_check_mark: |
| MySQL | mysql | :x: |
| Sqlite | sqlite | :x: |
2021-02-21 23:33:27 +03:00
## License
Licensed under either of these:
2021-02-22 11:47:56 +03:00
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE_APACHE) or
2021-02-21 23:33:27 +03:00
https://www.apache.org/licenses/LICENSE-2.0)
2021-02-22 11:47:56 +03:00
* MIT license ([LICENSE-MIT](LICENSE_MIT) or
2021-02-21 23:33:27 +03:00
https://opensource.org/licenses/MIT)