Skip to main content

QiLife Data Spine

Status and Authority

Active. ADR-0018 establishes Supabase Postgres as the canonical QiLife structured-data authority. The baseline migration is supabase/migrations/20260614162319_establish_qilife_entity_qibit_spine.sql. It is migration-ready but has not been deployed by this repository change.

Canonical Model

  • Entity: a who or what that persists through time.
  • QiBit: an event, observation, state change, fact, or unit of reality.
  • Every canonical structured record is represented as an Entity or QiBit.
  • QiBits may reference Entities.
This is a classification rule, not permission to discard domain meaning. Type-specific meaning remains governed in payloads until proven constraints or query needs justify dedicated columns or tables.

Storage Boundaries

  • Supabase stores canonical structured records and relationships.
  • QiNexus stores files, exports, references, archives, and backups.
  • Paperless may ingest, OCR, classify, and expose documents; it does not replace QiNexus file authority.
  • SQLite is deprecated and limited to legacy, local, or transitional use.

Tables

qi_entities.entities

ColumnTypeRulePurpose
iduuidPK, generatedStable Entity identity
entity_typetextrequired, nonblankGoverned Entity classification
display_nametextrequired, nonblankHuman-readable identity
attributesjsonbdefault {}Source-specific attributes
created_attimestamptzdefault nowCreation time
updated_attimestamptzdefault nowApplication-managed update time

qi_entities.relationships

ColumnTypeRulePurpose
iduuidPK, generatedRelationship identity
source_entity_iduuidFK -> entitiesRelationship origin
target_entity_iduuidFK -> entitiesRelationship target
relationship_typetextrequired, nonblankGoverned relationship meaning
attributesjsonbdefault {}Evidence or qualifiers
created_attimestamptzdefault nowCreation time
updated_attimestamptzdefault nowApplication-managed update time
Duplicate source, target, and type combinations are prevented. Foreign-key columns are indexed.

qi_events.qibits

ColumnTypeRulePurpose
iduuidPK, generatedQiBit identity
qibit_typetextrequired, nonblankGoverned unit classification
titletextrequired, nonblankHuman-readable label
summarytextoptionalConcise interpretation
occurred_attimestamptzdefault nowWhen the reality occurred
primary_entity_iduuidoptional FK -> entitiesPrimary who/what reference
payloadjsonbdefault {}Type-specific structured content
created_attimestamptzdefault nowCreation time
updated_attimestamptzdefault nowApplication-managed update time
The baseline supports one optional primary Entity reference. A many-Entity participant model requires evidence and a later ADR.

Security

  • RLS is enabled on all three tables.
  • No permissive client policies are included.
  • Custom schemas are not granted to anon or authenticated.
  • Identity ownership and access policies must be approved before Data API exposure.

Expansion Rules

Add columns or tables only when a required invariant, proven query, workflow constraint, or accepted ADR requires them. Do not create tagging, automation, AI, ingestion, or module schemas as part of this baseline.

Legacy SQLite Evidence

QiLife commit c589e1e contains a 15-table SQLModel/SQLite implementation. It remains evidence and a potential migration source, not canonical authority. No automatic conversion or data deletion is authorized.
Last modified on June 16, 2026