diff options
| author | Owen Jacobson <owen@grimoire.ca> | 2024-10-18 23:25:21 -0400 |
|---|---|---|
| committer | Owen Jacobson <owen@grimoire.ca> | 2024-10-18 23:27:21 -0400 |
| commit | d3fbecc57b5d6fa3223b945a45fe21eb78ffd49b (patch) | |
| tree | c62a5cb6636d5ef942c65e369e07b77fda42784c /src/channel/app.rs | |
| parent | 777e4281431a036eb663b5eec70f347b7425737d (diff) | |
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.
Diffstat (limited to 'src/channel/app.rs')
| -rw-r--r-- | src/channel/app.rs | 6 |
1 files changed, 3 insertions, 3 deletions
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<Channel, CreateError> { 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?; |
