diff --git a/nexus/catalog/src/lib.rs b/nexus/catalog/src/lib.rs index 32ee57c034..d24338b62c 100644 --- a/nexus/catalog/src/lib.rs +++ b/nexus/catalog/src/lib.rs @@ -24,18 +24,31 @@ pub struct Catalog { } async fn run_migrations(client: &mut Client) -> anyhow::Result<()> { - let migration_report = embedded::migrations::runner() + let migration = embedded::migrations::runner() .run_async(client) .await - .context("Failed to run migrations")?; - for migration in migration_report.applied_migrations() { - tracing::info!( - "Migration Applied - Name: {}, Version: {}", - migration.name(), - migration.version() - ); + .context("Failed to run migrations"); + match migration { + Ok(migration_report) => { + for migration in migration_report.applied_migrations() { + tracing::info!( + "Migration Applied - Name: {}, Version: {}", + migration.name(), + migration.version() + ); + } + Ok(()) + } + Err(err) => { + let errstr = err.to_string(); + if errstr.contains("duplicate key value violates unique constraint \"refinery_schema_history_pkey\"") || + errstr.contains("(typname, typnamespace)=(refinery_schema_history, 2200) already exists") { + Ok(()) + } else { + Err(err) + } + } } - Ok(()) } #[derive(Debug, Copy, Clone)]