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
sql 28 lines 1.58 KB
Raw
1 begin;
2
3 alter table subject add column archived_at timestamptz;
4 alter table subject add column updated_at timestamptz;
5 update subject set updated_at=created_at;
6 alter table subject alter column updated_at set default now();
7 alter table subject alter column updated_at set not null;
8 create index subject_active_owner_idx on subject(student_user_id,created_at desc) where archived_at is null;
9
10 alter table class_session add column archived_at timestamptz;
11 alter table class_session add column updated_at timestamptz;
12 update class_session set updated_at=created_at;
13 alter table class_session alter column updated_at set default now();
14 alter table class_session alter column updated_at set not null;
15 create index class_session_active_subject_idx on class_session(subject_id,weekday,starts_at) where archived_at is null;
16
17 alter table learning_checkin add column archived_at timestamptz;
18 alter table learning_checkin add column updated_at timestamptz;
19 alter table learning_checkin add column occurred_at timestamptz;
20 update learning_checkin set updated_at=created_at,occurred_at=created_at;
21 alter table learning_checkin alter column updated_at set default now();
22 alter table learning_checkin alter column updated_at set not null;
23 alter table learning_checkin alter column occurred_at set default now();
24 alter table learning_checkin alter column occurred_at set not null;
25 alter table learning_checkin add column source text not null default 'self_reported' check(source='self_reported');
26 create index learning_checkin_active_owner_idx on learning_checkin(owner_user_id,occurred_at desc) where archived_at is null;
27
28 commit;