use autoincrement id's everywhere #6
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_collab#6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
as id's use autocincrement u64 everywhere not long guids
make sure the _server,_ui, _web (if it exists), the openrpc, the sdk all gets changed to use incremental id's for everything
Implementation Spec for Issue #6: Use Autoincrement IDs Everywhere
Objective
Replace all UUID v4 string-based IDs with SQLite
INTEGER PRIMARY KEY AUTOINCREMENT(u64) IDs across every layer: server (db, models, handlers), OpenRPC spec, SDK, UI dashboard, and web crate.Current State
All entities (Workspace, User, Channel, Message, Document, Attachment, Room, Group, Mention) use
uuid::Uuid::new_v4().to_string(). The only exception isActivityLogEntry.idwhich already usesi64.Implementation Plan (10 Steps)
TEXT PRIMARY KEYtoINTEGER PRIMARY KEY AUTOINCREMENT, all FK columns fromTEXTtoINTEGERid: Stringtoid: u64, all FK fields fromStringtou64last_insert_rowid(), change param parsing fromas_str()toas_u64()"type": "string"to"type": "integer"u64Acceptance Criteria
INTEGER PRIMARY KEY AUTOINCREMENTu64for id and FK fieldslast_insert_rowid()andas_u64()"type": "integer"u64for all ID parameters and struct fieldsuuidcrate dependency removedcargo build --workspaceandcargo test --workspacepassNotes
Test Results
cargo build --workspace✅ Clean buildcargo test --workspace✅ All tests passImplementation Summary
Changes Made
All UUID-based string IDs have been replaced with autoincrement u64 IDs across the entire codebase:
Database (db.rs)
TEXT PRIMARY KEY→INTEGER PRIMARY KEY AUTOINCREMENTTEXT→INTEGERModels (models.rs)
id: String→id: u64u64/Option<u64>/Vec<u64>Handlers (8 entity handlers + 5 supporting handlers)
uuid::Uuid::new_v4()generationlast_insert_rowid()for autoincrement IDsas_str()→as_u64()OpenRPC Spec (openrpc.json)
"type": "string"→"type": "integer"SDK (lib.rs)
u64UI Dashboard (dashboard.js)
Number()for RPC callsWeb Crate (main.rs)
Number()Dependencies
uuidcrate removed from all Cargo.toml filesNotes
Implementation committed:
7035269Browse:
7035269