diff --git a/crates/buzz-db/src/store/channel.rs b/crates/buzz-db/src/store/channel.rs index b868ed8b61..be0a89a354 100644 --- a/crates/buzz-db/src/store/channel.rs +++ b/crates/buzz-db/src/store/channel.rs @@ -1417,7 +1417,8 @@ async fn update_channel_on( } if policy_changed { sqlx::query( - "UPDATE communities SET artifact_policy_modified_at=clock_timestamp() WHERE id=$1", + "UPDATE communities SET artifact_policy_modified_at=clock_timestamp() \ + WHERE id=$1 AND deletion_state = 'active'", ) .bind(community_id.as_uuid()) .execute(tx.conn()) @@ -1838,10 +1839,13 @@ async fn soft_delete_on(w: &mut ChannelSettingsWriter<'_>) -> Result<()> { .bind(channel_id) .execute(w.tx.conn()) .await?; - sqlx::query("UPDATE communities SET artifact_policy_modified_at=clock_timestamp() WHERE id=$1") - .bind(community_id.as_uuid()) - .execute(w.tx.conn()) - .await?; + sqlx::query( + "UPDATE communities SET artifact_policy_modified_at=clock_timestamp() \ + WHERE id=$1 AND deletion_state = 'active'", + ) + .bind(community_id.as_uuid()) + .execute(w.tx.conn()) + .await?; Ok(()) } diff --git a/crates/buzz-db/src/store/community_auth.rs b/crates/buzz-db/src/store/community_auth.rs index 21cee02ad2..e423134b0f 100644 --- a/crates/buzz-db/src/store/community_auth.rs +++ b/crates/buzz-db/src/store/community_auth.rs @@ -412,7 +412,8 @@ impl Db { .await?; let generation = old_generation + 1; sqlx::query( - "UPDATE communities SET policy_generation = $2, requires_nip_fi = $3 WHERE id = $1", + "UPDATE communities SET policy_generation = $2, requires_nip_fi = $3 \ + WHERE id = $1 AND deletion_state = 'active'", ) .bind(request.community_id) .bind(generation)