Skip to main content

Database Schema Documentation

This document provides comprehensive documentation for the KiraPilot database schema.

Generated on: 2025-08-24T14:14:12.213Z

Table of Contents​

Overview​

KiraPilot uses SQLite as its database engine with SeaORM as the ORM layer. The database is designed to support:

  • Task management with hierarchical relationships
  • Time tracking and session management
  • AI interaction history
  • User preferences and settings
  • Productivity analytics and patterns

Tables​

ai_interactions​

ColumnTypeNullableKeyDescription
idString✗PKUnique identifier for the record
messageString✗message field
responseString✗response field
action_takenString✓action taken field
reasoningString✓reasoning field
tools_usedString✓tools used field
confidencef64✓confidence field
created_atDateTimeUtc✗Timestamp when the record was created

ai_suggestions​

ColumnTypeNullableKeyDescription
idString✗PKUnique identifier for the record
suggestion_typeString✗suggestion type field
titleString✗Title or name of the item
descriptionString✗Detailed description
confidencef64✗confidence field
actionablebool✗actionable field
priorityi32✗Priority level
estimated_impactf64✗estimated impact field
reasoningString✓reasoning field
actionsString✓actions field
created_atDateTimeUtc✗Timestamp when the record was created
dismissed_atDateTimeUtc✓dismissed at field
applied_atDateTimeUtc✓applied at field

focus_sessions​

ColumnTypeNullableKeyDescription
idString✗PKUnique identifier for the record
task_idString✗FKReference to the associated task
planned_durationi32✗planned duration field
actual_durationi32✓actual duration field
focus_scoref64✓focus score field
distraction_counti32✗distraction count field
distraction_levelString✗distraction level field
background_audioString✓background audio field
notesString✓notes field
breaksString✓breaks field
metricsString✓metrics field
created_atDateTimeUtc✗Timestamp when the record was created
completed_atDateTimeUtc✓completed at field

productivity_patterns​

ColumnTypeNullableKeyDescription
idString✗PKUnique identifier for the record
user_idString✗FKReference to the user
pattern_typeString✗pattern type field
time_slotString✗time slot field
productivity_scoref64✗productivity score field
confidence_levelf64✗confidence level field
sample_sizei32✗sample size field
created_atDateTimeUtc✗Timestamp when the record was created
updated_atDateTimeUtc✗Timestamp when the record was last updated

task_dependencies​

ColumnTypeNullableKeyDescription
idString✗PKUnique identifier for the record
task_idString✗FKReference to the associated task
depends_on_idString✗FKdepends on id field
created_atDateTimeUtc✗Timestamp when the record was created

task_lists​

ColumnTypeNullableKeyDescription
idString✗PKUnique identifier for the record
nameString✗name field
is_defaultbool✗is default field
created_atDateTimeUtc✗Timestamp when the record was created
updated_atDateTimeUtc✗Timestamp when the record was last updated

Relationships:

  • has many → tasks

tasks​

ColumnTypeNullableKeyDescription
idString✗PKUnique identifier for the record
titleString✗Title or name of the item
descriptionString✓Detailed description
priorityi32✗Priority level
statusString✗Current status of the item
dependenciesString✓dependencies field
time_estimatei32✗time estimate field
actual_timei32✗actual time field
due_dateDateTimeUtc✓Due date for completion
scheduled_dateDateTimeUtc✓Scheduled date for execution
tagsString✓tags field
project_idString✓FKproject id field
parent_task_idString✓FKparent task id field
task_list_idString✓FKReference to the task list
subtasksString✓subtasks field
completed_atDateTimeUtc✓completed at field
created_atDateTimeUtc✗Timestamp when the record was created
updated_atDateTimeUtc✗Timestamp when the record was last updated

Relationships:

  • has many → task_dependencies
  • has many → time_sessions
  • has many → focus_sessions

time_sessions​

ColumnTypeNullableKeyDescription
idString✗PKUnique identifier for the record
task_idString✗FKReference to the associated task
start_timeDateTimeUtc✗Start time of the session
end_timeDateTimeUtc✓End time of the session
paused_timei32✗paused time field
is_activebool✗is active field
notesString✓notes field
breaksString✓breaks field
created_atDateTimeUtc✗Timestamp when the record was created

user_preferences​

ColumnTypeNullableKeyDescription
idString✗PKUnique identifier for the record
working_hoursString✗working hours field
break_preferencesString✗break preferences field
focus_preferencesString✗focus preferences field
notificationsString✗notifications field
themeString✓theme field
languageString✓language field
created_atDateTimeUtc✗Timestamp when the record was created
updated_atDateTimeUtc✗Timestamp when the record was last updated

Relationships​

The following diagram shows the relationships between tables:

erDiagram
AI_INTERACTIONS {
varchar id PK
varchar message
varchar response
varchar action_taken "nullable"
varchar reasoning "nullable"
varchar tools_used "nullable"
f64 confidence "nullable"
datetime created_at
}
AI_SUGGESTIONS {
varchar id PK
varchar suggestion_type
varchar title
varchar description
f64 confidence
boolean actionable
int priority
f64 estimated_impact
varchar reasoning "nullable"
varchar actions "nullable"
datetime created_at
datetime dismissed_at "nullable"
datetime applied_at "nullable"
}
FOCUS_SESSIONS {
varchar id PK
varchar task_id FK
int planned_duration
int actual_duration "nullable"
f64 focus_score "nullable"
int distraction_count
varchar distraction_level
varchar background_audio "nullable"
varchar notes "nullable"
varchar breaks "nullable"
varchar metrics "nullable"
datetime created_at
datetime completed_at "nullable"
}
PRODUCTIVITY_PATTERNS {
varchar id PK
varchar user_id FK
varchar pattern_type
varchar time_slot
f64 productivity_score
f64 confidence_level
int sample_size
datetime created_at
datetime updated_at
}
TASK_DEPENDENCIES {
varchar id PK
varchar task_id FK
varchar depends_on_id FK
datetime created_at
}
TASK_LISTS {
varchar id PK
varchar name
boolean is_default
datetime created_at
datetime updated_at
}
TASKS {
varchar id PK
varchar title
varchar description "nullable"
int priority
varchar status
varchar dependencies "nullable"
int time_estimate
int actual_time
datetime due_date "nullable"
datetime scheduled_date "nullable"
varchar tags "nullable"
varchar project_id FK "nullable"
varchar parent_task_id FK "nullable"
varchar task_list_id FK "nullable"
varchar subtasks "nullable"
datetime completed_at "nullable"
datetime created_at
datetime updated_at
}
TIME_SESSIONS {
varchar id PK
varchar task_id FK
datetime start_time
datetime end_time "nullable"
int paused_time
boolean is_active
varchar notes "nullable"
varchar breaks "nullable"
datetime created_at
}
USER_PREFERENCES {
varchar id PK
varchar working_hours
varchar break_preferences
varchar focus_preferences
varchar notifications
varchar theme "nullable"
varchar language "nullable"
datetime created_at
datetime updated_at
}
TASK_LISTS ||--o{ TASKS : "has_many"
TASKS ||--o{ TASK_DEPENDENCIES : "has_many"
TASKS ||--o{ TIME_SESSIONS : "has_many"
TASKS ||--o{ FOCUS_SESSIONS : "has_many"

Migration History​

TimestampDescriptionOperations
20240101_000001create tasks tablecreate_table
20240101_000002create task dependencies tablecreate_table, create_index
20240101_000003create time sessions tablecreate_table
20240101_000004create ai interactions tablecreate_table
20240101_000005create focus sessions tablecreate_table
20240101_000006create productivity patterns tablecreate_table
20240101_000007create user preferences tablecreate_table
20240101_000008create ai suggestions tablecreate_table
20240101_000009create indexescreate_index, create_index, create_index, create_index, create_index, create_index, create_index, create_index, create_index, create_index, create_index, create_index, create_index, create_index, create_index, create_index, create_index
20240101_000010create task lists tablecreate_table, create_index
20240101_000011add task list id to taskscreate_index
20240101_000012fix task lists unique index

Migration Details​

create tasks table (20240101_000001)​

Operations:

  • Create table

create task dependencies table (20240101_000002)​

Operations:

  • Create table
  • Create index

create time sessions table (20240101_000003)​

Operations:

  • Create table

create ai interactions table (20240101_000004)​

Operations:

  • Create table

create focus sessions table (20240101_000005)​

Operations:

  • Create table

create productivity patterns table (20240101_000006)​

Operations:

  • Create table

create user preferences table (20240101_000007)​

Operations:

  • Create table

create ai suggestions table (20240101_000008)​

Operations:

  • Create table

create indexes (20240101_000009)​

Operations:

  • Create index
  • Create index
  • Create index
  • Create index
  • Create index
  • Create index
  • Create index
  • Create index
  • Create index
  • Create index
  • Create index
  • Create index
  • Create index
  • Create index
  • Create index
  • Create index
  • Create index

create task lists table (20240101_000010)​

Operations:

  • Create table
  • Create index

add task list id to tasks (20240101_000011)​

Operations:

  • Create index

fix task lists unique index (20240101_000012)​