1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//! Bridge between *Springtime* and `refinery` migrations.

#[cfg(test)]
use mockall::automock;
use refinery_core::Migration;
use springtime::runner::ErrorPtr;
use springtime_di::injectable;

/// Embed migrations from a given path (`migrations` by default). Path is inspected for `*.sql`
/// files, which are converted into [MigrationSources](MigrationSource).
///
/// ```
/// use springtime_migrate_refinery::migration::embed_migrations;
/// embed_migrations!("examples/migrations");
/// ```
pub use springtime_migrate_refinery_macros::embed_migrations;

/// A source for [Migrations](Migration).
#[injectable]
#[cfg_attr(test, automock)]
pub trait MigrationSource {
    /// Provides a migration from this source.
    fn migrations(&self) -> Result<Vec<Migration>, ErrorPtr>;
}