pub struct Waypoint {
pub config: WaypointConfig,
/* private fields */
}Expand description
Main entry point for the Waypoint library.
Create a Waypoint instance with a config and use its methods to
run migration commands programmatically.
Fields§
§config: WaypointConfigImplementations§
Source§impl Waypoint
impl Waypoint
Sourcepub async fn new(config: WaypointConfig) -> Result<Self>
pub async fn new(config: WaypointConfig) -> Result<Self>
Create a new Waypoint instance, connecting to the database.
If connect_retries is configured, retries with exponential backoff.
Sourcepub fn with_client(config: WaypointConfig, client: Client) -> Self
pub fn with_client(config: WaypointConfig, client: Client) -> Self
Create a new Waypoint instance with an existing database client.
Sourcepub async fn migrate(
&self,
target_version: Option<&str>,
) -> Result<MigrateReport>
pub async fn migrate( &self, target_version: Option<&str>, ) -> Result<MigrateReport>
Apply pending migrations.
Sourcepub async fn info(&self) -> Result<Vec<MigrationInfo>>
pub async fn info(&self) -> Result<Vec<MigrationInfo>>
Show migration status information.
Sourcepub async fn validate(&self) -> Result<ValidateReport>
pub async fn validate(&self) -> Result<ValidateReport>
Validate applied migrations against local files.
Sourcepub async fn repair(&self) -> Result<RepairReport>
pub async fn repair(&self) -> Result<RepairReport>
Repair the schema history table.
Sourcepub async fn baseline(
&self,
version: Option<&str>,
description: Option<&str>,
) -> Result<()>
pub async fn baseline( &self, version: Option<&str>, description: Option<&str>, ) -> Result<()>
Baseline an existing database.
Sourcepub async fn undo(&self, target: UndoTarget) -> Result<UndoReport>
pub async fn undo(&self, target: UndoTarget) -> Result<UndoReport>
Undo applied migrations.
Sourcepub async fn clean(&self, allow_clean: bool) -> Result<Vec<String>>
pub async fn clean(&self, allow_clean: bool) -> Result<Vec<String>>
Drop all objects in managed schemas.
Sourcepub fn lint(
locations: &[PathBuf],
disabled_rules: &[String],
) -> Result<LintReport>
pub fn lint( locations: &[PathBuf], disabled_rules: &[String], ) -> Result<LintReport>
Run lint on migration files (no DB required).
Sourcepub fn changelog(
locations: &[PathBuf],
from: Option<&str>,
to: Option<&str>,
) -> Result<ChangelogReport>
pub fn changelog( locations: &[PathBuf], from: Option<&str>, to: Option<&str>, ) -> Result<ChangelogReport>
Generate changelog from migration files (no DB required).
Sourcepub async fn diff(&self, target: DiffTarget) -> Result<DiffReport>
pub async fn diff(&self, target: DiffTarget) -> Result<DiffReport>
Compare database schema against a target.
Sourcepub async fn drift(&self) -> Result<DriftReport>
pub async fn drift(&self) -> Result<DriftReport>
Detect schema drift.
Sourcepub async fn snapshot(
&self,
snapshot_config: &SnapshotConfig,
) -> Result<SnapshotReport>
pub async fn snapshot( &self, snapshot_config: &SnapshotConfig, ) -> Result<SnapshotReport>
Take a schema snapshot.
Sourcepub async fn restore(
&self,
snapshot_config: &SnapshotConfig,
snapshot_id: &str,
) -> Result<RestoreReport>
pub async fn restore( &self, snapshot_config: &SnapshotConfig, snapshot_id: &str, ) -> Result<RestoreReport>
Restore from a schema snapshot.
Sourcepub async fn explain(&self) -> Result<ExplainReport>
pub async fn explain(&self) -> Result<ExplainReport>
Run enhanced dry-run with EXPLAIN.
Sourcepub async fn preflight(&self) -> Result<PreflightReport>
pub async fn preflight(&self) -> Result<PreflightReport>
Run pre-flight health checks.
Sourcepub fn check_conflicts(
locations: &[PathBuf],
base_branch: &str,
) -> Result<ConflictReport>
pub fn check_conflicts( locations: &[PathBuf], base_branch: &str, ) -> Result<ConflictReport>
Check for branch conflicts (no DB required).
Sourcepub async fn safety(&self) -> Result<SafetyCommandReport>
pub async fn safety(&self) -> Result<SafetyCommandReport>
Analyze pending migrations for safety (lock analysis, impact estimation).
Sourcepub async fn advise(&self) -> Result<AdvisorReport>
pub async fn advise(&self) -> Result<AdvisorReport>
Run schema advisor to suggest improvements.
Sourcepub async fn simulate(&self) -> Result<SimulationReport>
pub async fn simulate(&self) -> Result<SimulationReport>
Simulate pending migrations in a throwaway schema.