a3s_orm/migration/
error.rs1#[derive(Debug, thiserror::Error, PartialEq, Eq)]
2pub enum MigrationError {
3 #[error("migration version cannot be empty")]
4 EmptyVersion,
5 #[error("migration {version:?} has an empty name")]
6 EmptyName { version: String },
7 #[error("migration {version:?} has empty SQL")]
8 EmptySql { version: String },
9 #[error("migration version contains unsupported characters: {0:?}")]
10 InvalidVersion(String),
11 #[error("duplicate migration version: {0:?}")]
12 DuplicateVersion(String),
13 #[error(
14 "migration {version:?} changed after it was applied (database {applied_checksum}, source {source_checksum})"
15 )]
16 ChecksumMismatch {
17 version: String,
18 applied_checksum: String,
19 source_checksum: String,
20 },
21 #[error("database contains migration {0:?} that is absent from the source")]
22 MissingSourceMigration(String),
23 #[error("required migration {0:?} has not been applied")]
24 MissingAppliedMigration(String),
25}
26
27#[derive(Debug, thiserror::Error)]
28pub enum MigrationRunError<E>
29where
30 E: std::error::Error + Send + Sync + 'static,
31{
32 #[error(transparent)]
33 Validation(#[from] MigrationError),
34 #[error("migration backend failed: {0}")]
35 Backend(E),
36}