diff --git a/src/cli/migrate_db.rs b/src/cli/migrate_db.rs index 1d06b9a2..c80fc79b 100644 --- a/src/cli/migrate_db.rs +++ b/src/cli/migrate_db.rs @@ -79,6 +79,15 @@ pub(crate) async fn run( info!("Migrating from {current:?} to {target:?}"); + if !services().globals.config.conduit_compat { + if let DbMigrationTarget::Conduit(_) = args.to { + return Err(Error::ConduitCompatDisabled); + } + if let DbVersion::Conduit(_) = current { + return Err(Error::ConduitCompatDisabled); + } + } + if target == current { // No-op } else if target == latest { diff --git a/src/error.rs b/src/error.rs index 727a6cb6..33bd121b 100644 --- a/src/error.rs +++ b/src/error.rs @@ -97,6 +97,14 @@ pub(crate) enum MigrateDbCommand { #[error("output path is not valid unicode")] InvalidUnicodeOutPath, + #[error( + "conduit_compat config option must be enabled to migrate database to \ + or from conduit. Note that you cannot currently enable \ + conduit_compat on a database that was originally created in \ + grapevine with it disabled." + )] + ConduitCompatDisabled, + #[error( "migrating a database may lose data even if the migration is \ successful. Because of this, it is very important to ensure you have \