Tearleads

document_calendar_index Client SQLite table

Per-document index ledger and calendar source metadata for hydrated Loro documents that participate in calendar queries.

Declared in packages/client-sdk/src/data/sqlite/schema/documentCalendarSchema.ts

Description

Rows are stamped with (index_version, snapshot_end_version) so incremental backfill skips already-indexed documents (including calendars with zero events or dated document types whose date fields are currently blank).

Columns

  • local_idtext
    • primary key
    • not null

    Local document id, matching documents.localId for rows whose appKind is documents.

  • index_versioninteger
    • not null
    • default 1

    Projection format version the row was built with. Backfill re-indexes a document whose version differs from the current one.

  • snapshot_end_versiontext
    • not null
    • default ''

    The document's snapshotEndVersion when it was indexed. Backfill re-indexes a document whose current value differs.

  • is_calendar_sourceinteger
    • not null
    • default 0

    1 when the document is a calendar (its projection supplies calendar metadata), otherwise 0. The calendar list reads only rows with 1.

  • calendar_colortext
    • nullable

    Calendar color as the document's projector supplies it, such as blue; null for documents that are not calendars.

  • calendar_descriptiontext
    • nullable

    Calendar description on one line, at most 1,024 characters; null when empty or not a calendar.

  • calendar_time_zonetext
    • nullable

    The calendar's default time zone name; null when unset or not a calendar.

Indexes

  • document_calendar_index_version_idx(index_version)
    • document_calendar_index_source_idx(is_calendar_source)

      DDL

      The statements the client runs to create this table and its indexes.

      CREATE TABLE IF NOT EXISTS "document_calendar_index" (
        "local_id" TEXT NOT NULL PRIMARY KEY,
        "index_version" INTEGER NOT NULL DEFAULT 1,
        "snapshot_end_version" TEXT NOT NULL DEFAULT '',
        "is_calendar_source" INTEGER NOT NULL DEFAULT 0,
        "calendar_color" TEXT,
        "calendar_description" TEXT,
        "calendar_time_zone" TEXT
      );
      
      CREATE INDEX IF NOT EXISTS "document_calendar_index_version_idx" ON "document_calendar_index" ("index_version");
      
      CREATE INDEX IF NOT EXISTS "document_calendar_index_source_idx" ON "document_calendar_index" ("is_calendar_source");