From 03dd3ddf8b8c0ad254850cd940728c888dd7a80c Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Tue, 11 Apr 2023 16:26:16 +0100 Subject: Switch to uuidv7 (#864) * Add uuid_v7 * Actually use the new uuid * Add a test to ensure all uuids are unique, even in a tight loop * Make clippy happy --- atuin-client/src/history.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'atuin-client/src/history.rs') diff --git a/atuin-client/src/history.rs b/atuin-client/src/history.rs index a710db2b..bb50a02a 100644 --- a/atuin-client/src/history.rs +++ b/atuin-client/src/history.rs @@ -3,7 +3,7 @@ use std::env; use chrono::Utc; use serde::{Deserialize, Serialize}; -use atuin_common::utils::uuid_v4; +use atuin_common::utils::uuid_v7; // Any new fields MUST be Optional<>! #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, sqlx::FromRow)] @@ -48,12 +48,12 @@ impl History { ) -> Self { let session = session .or_else(|| env::var("ATUIN_SESSION").ok()) - .unwrap_or_else(uuid_v4); + .unwrap_or_else(|| uuid_v7().as_simple().to_string()); let hostname = hostname.unwrap_or_else(|| format!("{}:{}", whoami::hostname(), whoami::username())); Self { - id: uuid_v4(), + id: uuid_v7().as_simple().to_string(), timestamp, command, cwd, -- cgit v1.3.1