dainvo

Data Model

This document describes the initial target SQLite tables. The schema will be implemented through migrations in later milestones.

accounts

Stores local and provider accounts.

calendars

Stores calendars visible to the app.

events

Stores calendar events used for rendering and sync reconciliation.

For ICS import, ical_uid is used as the duplicate key within a local calendar. Imports skip events when another event in the same calendar already has the same ical_uid; they do not update existing events yet. For ICS export, events missing an ical_uid receive a stable generated UID before the file is written.

event_attendees

Stores attendees for meetings and provider-backed events.

event_reminders

Stores event reminders.

Stores links from calendar events to documents, tasks, provider URLs, or other resources.

sync_states

Stores per-account or per-calendar sync cursors.

sync_operations

Stores queued provider mutations for outbox-style sync.

account_tokens

Stores encrypted provider credential payloads for connected accounts. The payload is encrypted by main-process TokenVault before it is written; renderer code must never receive this row or the decrypted payload.

tasks

Stores first-class tasks as a separate domain from calendar events. A task is the parent unit of work and owns completion state. Provider-backed tasks can later sync task content and completion with Todoist, but task calendar placement is modeled separately.

task_blocks

Stores calendar work sessions for tasks. These are not calendar events and must not be persisted through FullCalendar or the events table. One task can have many task_blocks, and every block points back to exactly one parent task. Completing the parent task makes all of its blocks render completed.

Todoist sync will apply to the parent task. If a Todoist due time creates a calendar placement, it should create or update one primary task block. Extra Dainvo blocks remain local scheduling data unless a later sync policy says otherwise.

task_projects

Stores provider-specific task project metadata for future Todoist sync.

task_sync_states

Stores account-level task sync cursors for future Todoist incremental sync.

task_sync_operations

Stores queued task-provider mutations for future outbox-style Todoist sync.

documents

Stores project documents or tasks that can be linked to calendar time blocks.

time_blocks

Stores scheduled work blocks linked to documents and calendar events.