LifeMate — Personal, Family & Learning Companion

test/android-reminder-acceptance
chore/phase1-repository-cleanup deploy/stable-web-apk deployment-static design/mobile-accessibility-v2 design/mobile-navigation-review docs/child-education-access-decision docs/offline-data-rescue-options docs/owner-guide-and-delivery-plan docs/phase1-policy-options docs/public-review-live-2026-10-15 feat/aparat-learning-library feat/child-device-safety feat/child-identity-schema feat/flutter-mobile-navigation feat/learning-content-operations feat/local-signing-preflight feat/online-family-stage0 feat/personal-encrypted-recovery feat/private-planner-series-api feat/public-review-page feat/standalone-weekly-planner feat/weekly-planner-android final-feature-1/iran-family-school fix/auth-abuse-expiry-safety fix/auth-expiry-after-lock fix/backend-request-safety fix/lifeguide-bootstrap-naming-ci fix/lifeguide-pages-qa-base-preflight fix/lifeguide-qa-pages-env-deployment fix/local-task-persistence fix/managed-child-session-boundary fix/personal-jalali-dates fix/personal-notification-controls fix/personal-upgrade-delivery-guard fix/sms-approval-gates fix/study-duration-display infra/cloudflare-neon-migration infra/lifeguide-cloudflare-qa infra/lifeguide-github-pages-qa infra/lifeguide-supabase-qa main phase-1/foundation-completion phase-2/product-foundation-identity phase-3/planner-school-family-core phase-4/ai-learning-wellbeing phase-5/hardening-observability-release test/android-reminder-acceptance test/personal-notification-settings test/personal-recovery-acceptance test/role-entry-apk
sql 34 lines 1.41 KB
Raw
1 begin;
2
3 -- A consented, explicitly chosen summary, never a copy of private chat/notes.
4 -- Withdrawal redacts the summary while preserving retry and rate-limit receipts.
5 create table learning_content_feedback (
6 id uuid primary key default gen_random_uuid(),
7 owner_user_id uuid not null references app_user(id) on delete cascade,
8 mutation_id uuid not null,
9 request_hash text not null check(request_hash ~ '^[0-9a-f]{64}$'),
10 unit_id uuid references learning_unit(id),
11 category text not null check(category in
12 ('inaccurate','edition_mismatch','broken_video','unclear','topic_request')),
13 summary text,
14 share_with_content_team boolean not null,
15 consented_at timestamptz not null default now(),
16 status text not null default 'received'
17 check(status in ('received','triaged','planned','released','declined')),
18 version integer not null default 1 check(version > 0),
19 created_at timestamptz not null default now(),
20 updated_at timestamptz not null default now(),
21 withdrawn_at timestamptz,
22 unique(owner_user_id,mutation_id),
23 check (
24 (withdrawn_at is null and share_with_content_team=true and summary is not null
25 and char_length(summary) between 1 and 1000 and length(trim(summary))>0)
26 or
27 (withdrawn_at is not null and share_with_content_team=false and summary is null)
28 )
29 );
30
31 create index learning_feedback_owner_time_idx
32 on learning_content_feedback(owner_user_id,created_at desc,id desc);
33
34 commit;