Files
heidi/drizzle/0004_sync_certificates.sql
CatoandClaude Opus 5.5 110f6e5ab3 feat(progress): progress on every device (opt-in), and a certificate per situation (#131)
Sync: signed in, off by default. Each device stores only what it observed; the
server keeps each device's records apart (progress_devices) and pages show the
sum, so nothing is counted twice however often devices sync. Model: sum;
history: union; streak: newest record, best of all; saved words: the newest
list is adopted, so deletions stay deleted. Server-side, every value goes
through the browser's own decoder and is stored normalised. Off removes this
device's copy; 'delete everything synced' removes all.

Certificates: issued by the server from synced progress with the same
strengthOf the situation page uses, only at 'sure'. A public, noindex page per
certificate shows the situation, date and what was measured; no name (one can
be typed for printing and is not stored). The scope line says it is listening
comprehension in one situation, not a language diploma.

Migration 0004 (progress_devices, certificates); both in APP_TABLES. Privacy
flows declared; the practice note now says 'unless you switch sync on'.
Roadmap items move to the changelog.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 04:53:58 -07:00

20 lines
738 B
SQL

CREATE TABLE "certificates" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"actor_id" text NOT NULL,
"scene_id" text NOT NULL,
"askable" integer NOT NULL,
"held" integer NOT NULL,
"stuck" integer NOT NULL,
"issued_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "progress_devices" (
"actor_id" text NOT NULL,
"device_id" text NOT NULL,
"key" text NOT NULL,
"value" jsonb NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
CONSTRAINT "progress_devices_actor_id_device_id_key_pk" PRIMARY KEY("actor_id","device_id","key")
);
--> statement-breakpoint
CREATE INDEX "certificates_actor_scene_idx" ON "certificates" USING btree ("actor_id","scene_id");