error migrating to/from conduit with conduit_compat disabled

In the future, we'll probably want to implement real support for
changing the admin bot userid. For now, just error so things don't break
in confusing ways.

We should note in the docs when creating a new server, that if you don't
enable conduit_compat you won't currently be able to migrate away.
This commit is contained in:
Benjamin Lee 2024-09-17 22:20:59 -07:00
parent 3226d3a9eb
commit 8e966c7ac4
No known key found for this signature in database
GPG key ID: FB9624E2885D55A4
2 changed files with 17 additions and 0 deletions

View file

@ -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 {

View file

@ -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 \