1use std::path::PathBuf;
5use thiserror::Error;
6
7#[derive(Error, Debug)]
10pub enum FlywayError {
11 #[error("Configuration error: {0}")]
14 ConfigError(String),
15
16 #[error("Database connection error: {0}")]
19 ConnectionError(#[from] sqlx::Error),
20
21 #[error("Migration script error: {0}")]
24 MigrationError(String),
25
26 #[error("Validation error: {0}")]
29 ValidationError(String),
30
31 #[error("Migration file not found: {0}")]
34 FileNotFound(PathBuf),
35
36 #[error("Invalid migration version: {0}")]
39 InvalidVersion(String),
40
41 #[error("Checksum mismatch for version {version}: expected {expected}, got {actual}")]
44 ChecksumMismatch {
45 version: String,
46 expected: i64,
47 actual: i64,
48 },
49
50 #[error("Migration {version} already applied")]
53 AlreadyApplied { version: String },
54
55 #[error("Out of order migration: {0}")]
58 OutOfOrder(String),
59
60 #[error("IO error: {0}")]
63 Io(#[from] std::io::Error),
64}
65
66pub type Result<T> = std::result::Result<T, FlywayError>;