#[cfg(feature = "sqlx")]
mod from_postgres;
mod table;
mod r#type;
mod column;
mod index;
pub use column::Column;
pub use r#type::Type;
pub use table::Table;
use anyhow::Result;
use crate::migrate::{Migration, migrate, MigrationOptions};
#[derive(Debug, Default)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Schema {
pub tables: Vec<Table>,
}
impl Schema {
pub fn migrate_to(self, desired: Schema, options: &MigrationOptions) -> Result<Migration> {
migrate(self, desired, options)
}
pub fn name_schema(&mut self, schema: &str) {
for table in &mut self.tables {
table.schema = Some(schema.to_string());
}
}
}