Add user model and SQLite storage #8

Open
opened 2026-02-25 16:05:09 +01:00 by libretech · 0 comments
Owner

Summary

Design and implement the user model and SQLite database layer for multi-tenant user management.

User Model

User {
id: UUID (primary key)
email: string (unique, indexed)
created_at: timestamp
last_login_at: timestamp
storage_path: string
}

Implementation Tasks

  • Choose SQLite driver for Go (e.g., modernc.org/sqlite or mattn/go-sqlite3)
  • Create database schema with migrations
  • Implement user CRUD operations
  • Add email uniqueness constraint
  • Implement connection pooling / WAL mode configuration
  • Add database initialization on first run
  • Write unit tests for user storage operations

Design Decisions

  • SQLite chosen for simplicity and zero-dependency deployment
  • WAL mode for concurrent read access
  • UUID primary keys for non-sequential user IDs

Acceptance Criteria

  • User model supports create, read, update, delete operations
  • Email uniqueness is enforced at the database level
  • Database is created automatically on first run
  • SQLite WAL mode is enabled for concurrent access
  • Unit tests pass for all CRUD operations
## Summary Design and implement the user model and SQLite database layer for multi-tenant user management. ## User Model User { id: UUID (primary key) email: string (unique, indexed) created_at: timestamp last_login_at: timestamp storage_path: string } ## Implementation Tasks - [ ] Choose SQLite driver for Go (e.g., modernc.org/sqlite or mattn/go-sqlite3) - [ ] Create database schema with migrations - [ ] Implement user CRUD operations - [ ] Add email uniqueness constraint - [ ] Implement connection pooling / WAL mode configuration - [ ] Add database initialization on first run - [ ] Write unit tests for user storage operations ## Design Decisions - SQLite chosen for simplicity and zero-dependency deployment - WAL mode for concurrent read access - UUID primary keys for non-sequential user IDs ## Acceptance Criteria - [ ] User model supports create, read, update, delete operations - [ ] Email uniqueness is enforced at the database level - [ ] Database is created automatically on first run - [ ] SQLite WAL mode is enabled for concurrent access - [ ] Unit tests pass for all CRUD operations
libretech added the
phase-1
label 2026-02-25 16:05:09 +01:00
libretech added the
task
label 2026-02-28 20:26:10 +01:00
libretech added the
backend
database
labels 2026-02-28 22:00:42 +01:00
Sign in to join this conversation.
No description provided.