enhance: compact & upgrade database
This commit is contained in:
1 parent
0b2bf20e50
commit
0d9c8c79b4
3 files changed
+8
-3
No files matched your search
Vendored
+5
-2
@@ -3,9 +3,12 @@ use std::sync::LazyLock;
|
||||
use redb::{ReadTransaction, Table, TableDefinition, WriteTransaction};
|
||||
|
||||
static DATABASE: LazyLock<redb::Database> = LazyLock::new(|| {
|
||||
redb::Database::builder()
|
||||
let mut db = redb::Database::builder()
|
||||
.create("players.redb")
|
||||
.expect("failed to open database")
|
||||
.expect("failed to open database");
|
||||
_ = db.upgrade();
|
||||
_ = db.compact();
|
||||
db
|
||||
});
|
||||
|
||||
pub const PLAYERS: TableDefinition<'_, u32, Vec<u8>> = redb::TableDefinition::new("players");
|
||||
|
||||
Reference in new issue
Block a user