mirror of
https://github.com/block/buzz.git
synced 2026-10-31 14:31:02 +00:00
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 <noreply@anthropic.com> Signed-off-by: Matt Toohey <contact@matttoohey.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user