Skip to content

Commit

Permalink
Fleshing out the crate disclaimer a bit further
Browse files Browse the repository at this point in the history
  • Loading branch information
spacekookie authored Mar 30, 2018
1 parent 9a941d5 commit 944da0f
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions guides/diesel-setup.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Diesel setup

**Disclaimer:** the barrel crate is still in an early state of development and should not be considered "stable". Use at your own risk!

### Disclaimer
> The barrel crate is still in an early state of development and should not be considered "stable".
>
> Old migrations might break because the API was changed. Features might be removed or replaced! **Before 1.0 this crate is not stable and should __not__ be used in production** – just wanted to make that loud and clear :)
Using rust migrations (via `barrel`) with `diesel` is really simple. First, you need to add the `rust-migrations` to the features list for your `diesel` dependency. Note that currently `barrel` only supports postgres databases.

Expand All @@ -23,4 +27,16 @@ From this point using `diesel` is very similar to how you normally use it. The o
~ diesel migration generate <name> --type="rust"
~ diesel migration run
...
```
```

A migration file generated by diesel will look as follows

```rust
/// Handle up migrations
fn up(migr: &mut Migration) {}

/// Handle down migrations
fn down(migr: &mut Migration) {}
```

The object provided as a function parameter is a mutable `Migration` object which you can operate on. Please refer to [the docs](https://docs.rs/barrel/0.2.0/barrel/migration/struct.Migration.html) for API specifics.

0 comments on commit 944da0f

Please sign in to comment.