LifeMate — Personal, Family & Learning Companion
feat/learning-content-operations
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 | begin; |
| 2 | |
| 3 | create table auth_credential ( |
| 4 | user_id uuid primary key references app_user(id) on delete cascade, |
| 5 | password_hash text not null, |
| 6 | password_changed_at timestamptz not null default now(), |
| 7 | failed_attempts integer not null default 0 check (failed_attempts >= 0), |
| 8 | locked_until timestamptz |
| 9 | ); |
| 10 | |
| 11 | create type auth_token_kind as enum ('email_verification','password_reset'); |
| 12 | create table auth_token ( |
| 13 | id uuid primary key default gen_random_uuid(), |
| 14 | user_id uuid not null references app_user(id) on delete cascade, |
| 15 | kind auth_token_kind not null, |
| 16 | token_digest text not null unique, |
| 17 | expires_at timestamptz not null, |
| 18 | used_at timestamptz, |
| 19 | created_at timestamptz not null default now(), |
| 20 | check (expires_at > created_at) |
| 21 | ); |
| 22 | create index auth_token_active_idx on auth_token(user_id, kind, expires_at) where used_at is null; |
| 23 | |
| 24 | create table auth_session ( |
| 25 | id uuid primary key default gen_random_uuid(), |
| 26 | user_id uuid not null references app_user(id) on delete cascade, |
| 27 | refresh_digest text not null unique, |
| 28 | expires_at timestamptz not null, |
| 29 | revoked_at timestamptz, |
| 30 | created_at timestamptz not null default now(), |
| 31 | last_seen_at timestamptz not null default now() |
| 32 | ); |
| 33 | create index auth_session_user_active_idx on auth_session(user_id, expires_at) where revoked_at is null; |
| 34 | |
| 35 | commit; |