Use UUIDv7 as primary key

This commit is contained in:
Luke Harding 2024-05-03 14:39:47 -04:00
parent c6edcbd009
commit ff3d302f18
3 changed files with 9 additions and 2 deletions

7
server/Cargo.lock generated
View File

@ -248,6 +248,12 @@ dependencies = [
"libc",
]
[[package]]
name = "atomic"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c59bdb34bc650a32731b31bd8f0829cc15d24a708ee31559e0bb34f2bc320cba"
[[package]]
name = "autocfg"
version = "1.2.0"
@ -1366,6 +1372,7 @@ version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0"
dependencies = [
"atomic",
"getrandom",
"serde",
]

View File

@ -13,4 +13,4 @@ diesel_migrations = { version = "2.1.0", features = ["postgres"] }
dotenvy = "0.15.7"
serde = { version = "1.0.200", features = ["derive"] }
serde_json = "1.0.116"
uuid = { version = "1.8.0", features = ["v4", "serde"] }
uuid = { version = "1.8.0", features = ["v7", "serde"] }

View File

@ -46,7 +46,7 @@ struct JsonTask {
#[post("/create_task")]
pub async fn create_task(data: web::Data<AppState>, task: web::Json<JsonTask>) -> impl Responder {
let uuid = Uuid::new_v4();
let uuid = Uuid::now_v7();
let new_task = match db::create_task(
data.database_url.clone(),