LifeMate — Personal, Family & Learning Companion
docs/phase1-policy-options
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
| 1 | \set ON_ERROR_STOP on |
| 2 | |
| 3 | begin; |
| 4 | |
| 5 | insert into app_user(id, identity_subject, email_normalized) values |
| 6 | ('00000000-0000-0000-0000-000000000001','parent-1','parent@example.test'), |
| 7 | ('00000000-0000-0000-0000-000000000002','teen-1','teen@example.test'), |
| 8 | ('00000000-0000-0000-0000-000000000003','other-1','other@example.test'); |
| 9 | |
| 10 | insert into family_workspace(id,name,created_by) values |
| 11 | ('10000000-0000-0000-0000-000000000001','Test Family','00000000-0000-0000-0000-000000000001'); |
| 12 | |
| 13 | insert into family_membership(family_id,user_id,role,is_admin) values |
| 14 | ('10000000-0000-0000-0000-000000000001','00000000-0000-0000-0000-000000000001','parent_guardian',true), |
| 15 | ('10000000-0000-0000-0000-000000000001','00000000-0000-0000-0000-000000000002','teen_minor',false); |
| 16 | |
| 17 | insert into guardian_relationship(family_id,guardian_user_id,minor_user_id) values |
| 18 | ('10000000-0000-0000-0000-000000000001','00000000-0000-0000-0000-000000000001','00000000-0000-0000-0000-000000000002'); |
| 19 | |
| 20 | do $$ |
| 21 | begin |
| 22 | if not is_active_family_member('10000000-0000-0000-0000-000000000001','00000000-0000-0000-0000-000000000002') then raise exception 'teen must be active family member'; end if; |
| 23 | if is_active_family_member('10000000-0000-0000-0000-000000000001','00000000-0000-0000-0000-000000000003') then raise exception 'outsider must not be family member'; end if; |
| 24 | if not is_family_admin('10000000-0000-0000-0000-000000000001','00000000-0000-0000-0000-000000000001') then raise exception 'parent admin capability missing'; end if; |
| 25 | if is_family_admin('10000000-0000-0000-0000-000000000001','00000000-0000-0000-0000-000000000002') then raise exception 'teen must not inherit admin capability'; end if; |
| 26 | if not is_active_guardian('10000000-0000-0000-0000-000000000001','00000000-0000-0000-0000-000000000001','00000000-0000-0000-0000-000000000002') then raise exception 'guardian relation missing'; end if; |
| 27 | if is_active_guardian('10000000-0000-0000-0000-000000000001','00000000-0000-0000-0000-000000000003','00000000-0000-0000-0000-000000000002') then raise exception 'outsider must not become guardian'; end if; |
| 28 | end $$; |
| 29 | |
| 30 | update family_membership |
| 31 | set ended_at=now() |
| 32 | where family_id='10000000-0000-0000-0000-000000000001' |
| 33 | and user_id='00000000-0000-0000-0000-000000000002'; |
| 34 | |
| 35 | do $$ |
| 36 | begin |
| 37 | if is_active_family_member('10000000-0000-0000-0000-000000000001','00000000-0000-0000-0000-000000000002') then raise exception 'removed teen must not remain active member'; end if; |
| 38 | if is_active_guardian('10000000-0000-0000-0000-000000000001','00000000-0000-0000-0000-000000000001','00000000-0000-0000-0000-000000000002') then raise exception 'guardian relationship must deactivate when minor membership ends'; end if; |
| 39 | end $$; |
| 40 | |
| 41 | rollback; |