pub(crate) enum MigrationPool {
    #[cfg(feature = "sqlite")]
    Sqlite(quex::Pool),
    #[cfg(feature = "postgres")]
    Postgres(quex::Pool),
    #[cfg(feature = "mariadb")]
    Mariadb(quex::Pool),
    #[cfg(not(any(feature = "sqlite", feature = "postgres", feature = "mariadb")))]
    Disabled,
}

impl MigrationPool {
    pub(crate) fn pool(&self) -> &quex::Pool {
        match self {
            #[cfg(feature = "sqlite")]
            Self::Sqlite(pool) => pool,
            #[cfg(feature = "postgres")]
            Self::Postgres(pool) => pool,
            #[cfg(feature = "mariadb")]
            Self::Mariadb(pool) => pool,
            #[cfg(not(any(feature = "sqlite", feature = "postgres", feature = "mariadb")))]
            Self::Disabled => panic!("migration pool backend is not enabled"),
        }
    }

    #[allow(dead_code)]
    pub(crate) fn backend_name(&self) -> &'static str {
        match self {
            #[cfg(feature = "sqlite")]
            Self::Sqlite(_) => "sqlite",
            #[cfg(feature = "postgres")]
            Self::Postgres(_) => "postgres",
            #[cfg(feature = "mariadb")]
            Self::Mariadb(_) => "mariadb",
            #[cfg(not(any(feature = "sqlite", feature = "postgres", feature = "mariadb")))]
            Self::Disabled => "disabled",
        }
    }
}
