[E7.S4] Initialize SQLite Database & Exposed Schema #46
Labels
No labels
Epic 5
MCP
P1
PR-0
PR-1
api
api-layer
architecture
area:backend
area:frontend
arrow
authentication
backend
bug
chat
client
clipboard
common-module
compose
cross-cutting
cross-cutting-requirement
data-layer
data-models
database
desktop-client
documentation
duplicate
enhancement
epic
epic-1
epic-2
epic-3
epic-4
epic-5
epic-6
epic-7
epic-llm-config
error-handling
feature
frontend
good first issue
help wanted
implementation
infrastructure
installer
invalid
kotlin
ktor
llm
medium-priority
message
multiplatform
needs-review
needs-triage
packaging
performance
phase-1
phase-2
phase-3
phase-4
phase-5
phase3
phase:3
priority: high
question
refactor
refactoring
resource-sharing
security
server
server-module
services
session
session-management
settings
setup
shutdown
state
storage
streaming
sub-issue
tests
tooling
type:task
ui
ui/ux
user-accounts
user-management
ux
viewmodel
websocket
windows
windows-integration
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Torvian.eu/chatbot#46
Loading…
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?
Description
As a developer, I need the application to connect to the SQLite database file on startup and ensure all necessary tables, indexes, and foreign key constraints are created or updated using Exposed, so that data persistence works reliably, including support for message threading relationships.
Acceptance Criteria
servermodule'sdata.exposedpackage.chat.db) is created in a user-specific, platform-appropriate location if it doesn't exist.ChatSessions,ChatMessages,LLMModels,ModelSettings) are defined in theservermodule'sdata.modelspackage, reflecting the schema requirements.ChatMessagesExposed Table definition includes a column forparentMessageId(Long, nullable, treated as a foreign key referencingChatMessages.id) and a column forchildrenMessageIds(likely stored as a serialized data type like JSON or comma-separated string).SchemaUtils.create(or similar Exposed migration features) runs on startup to create tables if they are missing.ChatMessage.sessionIdreferencingChatSession.idwithReferenceOption.CASCADEforonDelete. Optionally,ChatMessage.parentMessageIdreferencingChatMessage.idcould be defined as a self-referencing foreign key withReferenceOption.SET_NULLon delete for the orphan strategy, but for V1.1 the orphan logic is handled at the Service/DAO layer.ChatMessage.sessionId,ChatMessage.parentMessageId,ModelSettings.modelId,ChatSession.groupId.Implementation Details
This story involves setting up the SQLite database connection and defining the schema using Exposed ORM. Key considerations include:
Dependencies
Parent Epic
Epic 7: Application Core Framework & Windows 11 Integration
Related Stories