aboutsummaryrefslogtreecommitdiff
path: root/base/src/database.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-01-20 12:13:20 +0100
committermetamuffin <metamuffin@disroot.org>2024-01-20 12:13:20 +0100
commit730353601db9818d148c85bfe1ecb119abaab7cc (patch)
tree0e3deafdac53ebc612a04b3631e5cf286c825291 /base/src/database.rs
parent3086e768ab4e64e47a50d7f6a71a815c4f110bd3 (diff)
downloadjellything-730353601db9818d148c85bfe1ecb119abaab7cc.tar
jellything-730353601db9818d148c85bfe1ecb119abaab7cc.tar.bz2
jellything-730353601db9818d148c85bfe1ecb119abaab7cc.tar.zst
cleanup yesterdays mess
Diffstat (limited to 'base/src/database.rs')
-rw-r--r--base/src/database.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/base/src/database.rs b/base/src/database.rs
index 2a57937..f6f21bd 100644
--- a/base/src/database.rs
+++ b/base/src/database.rs
@@ -9,6 +9,7 @@ use jellycommon::{
Node,
};
use log::info;
+use serde::{Deserialize, Serialize};
use std::{borrow::Borrow, ops::Deref, path::Path};
pub use redb::*;
@@ -32,6 +33,7 @@ impl DataAcid {
let r = Self { inner: db };
{
+ // this creates all tables such that read operations on them do not fail.
let txn = r.begin_write()?;
drop(txn.open_table(T_INVITE)?);
drop(txn.open_table(T_USER)?);
@@ -62,7 +64,7 @@ impl<'a, 'b, 'c, Key, Value, KeyRef> TableExt<Key, KeyRef, Value>
for TableDefinition<'a, Key, Ser<Value>>
where
Key: Borrow<<Key as RedbValue>::SelfType<'b>> + redb::RedbKey,
- Value: bincode::Encode + bincode::Decode + std::fmt::Debug,
+ Value: Encode + Decode + std::fmt::Debug + Serialize + for<'x> Deserialize<'x>,
KeyRef: Borrow<<Key as redb::RedbValue>::SelfType<'c>>,
{
fn get(self, db: &DataAcid, key: KeyRef) -> anyhow::Result<Option<Value>> {