From 03651ae9bc0cb07a9adcd8dc2be9cb6ef45c8983 Mon Sep 17 00:00:00 2001 From: Matt Toohey Date: Thu, 29 Oct 2026 16:37:55 +1100 Subject: [PATCH] test(db): derive the latest migration in the 0075 invite upgrade test Rebasing onto main put this branch's `channels.auto_join` migration at 0076, after main's 0074 (user deletion fences) and 0075 (invite revocation). `migration_schema_0075_adds_invite_columns_without_rewriting_history` asserted that a full migrate ends at version 75, so it failed once 0076 existed. It now reads the latest version from the migrations directory, as `thread_window_postgres_tests` already does, so the next migration does not break it again. The renumbering itself (0074 -> 0076, with the migrator pin test resolved to main's contiguity loop at 76) was applied in the replayed "add a channel auto_join setting" commit. Every SELECT that feeds `row_to_channel_record` already selects `auto_join`, and the three auto-join call sites sit in the same arms after main's invite-revocation rewrite, so nothing else needed to change. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Matt Toohey --- .../src/store/relay_invite/upgrade_postgres_tests.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/buzz-db/src/store/relay_invite/upgrade_postgres_tests.rs b/crates/buzz-db/src/store/relay_invite/upgrade_postgres_tests.rs index fd06aa0e62..13abbb68bf 100644 --- a/crates/buzz-db/src/store/relay_invite/upgrade_postgres_tests.rs +++ b/crates/buzz-db/src/store/relay_invite/upgrade_postgres_tests.rs @@ -506,12 +506,21 @@ async fn apply_pgschema_to_existing_database(pool: &PgPool) { async fn migration_schema_0075_adds_invite_columns_without_rewriting_history() { let (pool, cases) = legacy_fixture().await; crate::migration::run_migrations(&pool).await.unwrap(); + let latest = sqlx::migrate::Migrator::new( + std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../migrations"), + ) + .await + .unwrap() + .iter() + .map(|m| m.version) + .max() + .unwrap(); assert_eq!( sqlx::query_scalar::<_, i64>("SELECT max(version) FROM _sqlx_migrations WHERE success") .fetch_one(&pool) .await .unwrap(), - 75 + latest ); assert_admission_column(&pool).await; assert_join_role_preserved(&pool, cases[0].community).await;