use crate::migrations_directory::MigrationDirectory;
use psl::parser_database::SourceFile;
use std::fmt::Debug;
pub enum DiffTarget<'a> {
Datamodel(SourceFile),
Migrations(&'a [MigrationDirectory]),
Database,
Empty,
}
impl Debug for DiffTarget<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
DiffTarget::Datamodel(_) => f.debug_struct("DiffTarget::Datamodel").finish(),
DiffTarget::Migrations(_) => f.debug_struct("DiffTarget::Migrations").finish(),
DiffTarget::Database => f.debug_struct("DiffTarget::Database").finish(),
DiffTarget::Empty => f.debug_struct("DiffTarget::Empty").finish(),
}
}
}
impl DiffTarget<'_> {
pub fn as_datamodel(&self) -> Option<&str> {
match self {
DiffTarget::Datamodel(schema) => Some(schema.as_str()),
_ => None,
}
}
}