sqlx/tests/migrate/macro.rs
Austin Bonander e89cb0971a
fix(macros): tell the compiler about external files/env vars to watch (#1332)
* fix(macros): tell the compiler about external files/env vars to watch

closes #663
closes #681

* feat(cli): add `migrate` subcommand for generating a build script

suggest embedding migrations on `sqlx migrate add` in a new project
2021-07-21 16:36:22 -07:00

21 lines
588 B
Rust

use sqlx::migrate::Migrator;
use std::path::Path;
static EMBEDDED: Migrator = sqlx::migrate!("tests/migrate/migrations");
#[sqlx_macros::test]
async fn same_output() -> anyhow::Result<()> {
let runtime = Migrator::new(Path::new("tests/migrate/migrations")).await?;
assert_eq!(runtime.migrations.len(), EMBEDDED.migrations.len());
for (e, r) in EMBEDDED.iter().zip(runtime.iter()) {
assert_eq!(e.version, r.version);
assert_eq!(e.description, r.description);
assert_eq!(e.sql, r.sql);
assert_eq!(e.checksum, r.checksum);
}
Ok(())
}