From 1e1908d734d4827e09744288bc046f1e3fd03711 Mon Sep 17 00:00:00 2001 From: Kyle Leonhard Date: Wed, 6 Nov 2024 10:44:34 -0800 Subject: [PATCH] Warn when migration was inferred as non-reversible and user set reversible --- sqlx-cli/src/migrate.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sqlx-cli/src/migrate.rs b/sqlx-cli/src/migrate.rs index e00f6de651..4b9f0ab17a 100644 --- a/sqlx-cli/src/migrate.rs +++ b/sqlx-cli/src/migrate.rs @@ -113,6 +113,9 @@ pub async fn add( // Type of newly created migration will be the same as the first one // or reversible flag if this is the first migration let migration_type = MigrationType::infer(&migrator, reversible); + if reversible && !migration_type.is_reversible() { + println!("Cannot create reversible migration since prior migrations are not reversible."); + } let ordering = MigrationOrdering::infer(sequential, timestamp, &migrator); let file_prefix = ordering.file_prefix();