From d3fbecc57b5d6fa3223b945a45fe21eb78ffd49b Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Fri, 18 Oct 2024 23:25:21 -0400 Subject: Switch to blanking tombstoned data with null, not empty string. This accomplishes two things: * It removes the need for an additional `channel_name_reservation` table, since `channel.name` now only contains non-null values for active channels, and * It nicely dovetails with the idea that `null` means an unknown value in SQL-land. --- src/channel/app.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/channel/app.rs') diff --git a/src/channel/app.rs b/src/channel/app.rs index 0409076..75c662d 100644 --- a/src/channel/app.rs +++ b/src/channel/app.rs @@ -23,9 +23,9 @@ impl<'a> Channels<'a> { pub async fn create(&self, name: &str, created_at: &DateTime) -> Result { let mut tx = self.db.begin().await?; let created = tx.sequence().next(created_at).await?; - let channel = tx.channels().create(name, &created).await?; - tx.channels() - .reserve_name(&channel, name) + let channel = tx + .channels() + .create(name, &created) .await .duplicate(|| CreateError::DuplicateName(name.into()))?; tx.commit().await?; -- cgit v1.2.3