sqlx_core_oldapi/migrate/
error.rs

1use crate::error::{BoxDynError, Error};
2
3#[derive(Debug, thiserror::Error)]
4#[non_exhaustive]
5pub enum MigrateError {
6    #[error("could not run migration {0}")]
7    Execute(i64, #[source] Error),
8
9    #[error("while resolving migrations: {0}")]
10    Source(#[source] BoxDynError),
11
12    #[error("migration {0} was previously applied but is missing in the resolved migrations")]
13    VersionMissing(i64),
14
15    #[error("migration {0} was previously applied but has been modified")]
16    VersionMismatch(i64),
17
18    #[error("cannot mix reversible migrations with simple migrations. All migrations should be reversible or simple migrations")]
19    InvalidMixReversibleAndSimple,
20
21    // NOTE: this will only happen with a database that does not have transactional DDL (.e.g, MySQL or Oracle)
22    #[error(
23        "migration {0} is partially applied; fix and remove row from `_sqlx_migrations` table"
24    )]
25    Dirty(i64),
26
27    #[error("unable to acquire a connection to the database")]
28    AcquireConnection(#[source] Error),
29
30    #[error("an operation on the migration metadata table (_sqlx_migrations) failed")]
31    AccessMigrationMetadata(#[source] Error),
32}
33
34pub type MigrateResult<T> = std::result::Result<T, MigrateError>;