| Crates.io | pg-migrator |
| lib.rs | pg-migrator |
| version | 0.2.1 |
| created_at | 2023-09-08 23:31:35.314151+00 |
| updated_at | 2023-09-09 20:17:26.814649+00 |
| description | Macro free Postgres migration tool for Rust Postgres and Tokio Postgres |
| homepage | https://github.com/faveroferreira/pg-migrator |
| repository | https://github.com/faveroferreira/pg-migrator |
| max_upload_size | |
| id | 967852 |
| size | 15,207 |
Pg-Migrator is a simple, macro-free, crate for running migrations on Postgres databases.
For rust-postgres use:
[dependencies]
pg-migrator = { version = "0.1.0", features = ["postgres"] }
For tokio-postgres use:
[dependencies]
pg-migrator = { version = "0.1.0", features = ["tokio-postgres"] }
Then, create your Postgres/Tokio Postgres connection as always and run the migrations:
use postgres::{Client, NoTls, Error};
fn main() {
let mut client = Client::connect("postgresql://postgres:postgres@localhost/library", NoTls).unwrap();
PostgresMigrator::new("./migrations")
.migrate(&mut conn)
.unwrap();
}