023_schema.sql is the whole database as the 23 migrations left it:
every table in its final shape (columns added by ALTER folded into
their CREATE), its indexes, the five views, the seed rows (event
scopes, the shipped front page) and the triggers, last. The reasoning
from the old files that still applies sits next to what it explains;
the rest is in git history.
A fresh database runs it and lands at v23; one already at v23 skips
it. migrate() now treats the first file as a baseline and refuses a
database between v1 and v22 with a message saying to upgrade it on
an older release first, rather than failing halfway on CREATE TABLE.
Production is at v19, so the previous commits on this branch
(020–023) have to be deployed before this one.
Checked by building a database from the old files and one from this
file and comparing them: strictness, columns, types, defaults,
nullability, keys, foreign keys and their actions, CHECK constraints,
index definitions, view and trigger SQL, and seed rows all match.
Comments that cited migration numbers now point at the schema, and
CLAUDE.md describes the baseline and where new migrations go.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Migrations 020–023, with the code that reads each:
- 020 drops people_lists, people_list_members, v_chapters and
v_person_affiliations. Nothing queried any of them.
- 021 renames event_sections to event_scopes and events.section_id
to scope_id, finishing what 015 described. The API sends `scopes`
and `scope_id`, and useEvents, EventListCards and EventCalendar
take `scope`. It also inserts national/regional/partner, which only
the retired seed ever created: a database built from migrations
alone had no scope for the Retreats bands.
- 022 drops events.sort_order and people.sort_order. Events now sort
by date (upcoming soonest first, past latest first, undated last)
on /events, org pages and the countdown. People were only ever
sorted by sort_name on the site. Every other sort_order stays.
- 023 rebuilds teams with created_at and updated_at plus a touch
trigger, so the teams editor gets the same optimistic concurrency
as the other entities.
Awards can be drafted: is_published (added in 011) is on both
descriptor halves with a Publishing group, and the award list, award
page, org awards and event awards leave drafts out.
The migration runner now turns foreign keys off around the per-file
transactions and runs foreign_key_check before each commit. PRAGMA
foreign_keys is a no-op inside a transaction, so 009's warning was
right and a rebuild of a referenced table (023) couldn't be written
otherwise. CLAUDE.md is updated to match.
Also removes the stray src/App.tsx.save.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
seed.js moved the v1.2 static content into SQLite. Its chapter
source, src/pages/chapters.js, was deleted in the same commit that
added it, and the default path pointed at src/data/chapters, which
is the API hook and has none of GROUPS/SPLITS/CHAPTERS. Given the
old file, it still fails on today's schema (events.host_org_id went
with co-hosting), and a working run would wipe everything entered
through the admin since.
The database is the source of truth now. Removes seed.js, the
seed-only src/data/events.ts, and the seed command from CLAUDE.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Renames every .js module under src/ to .ts (api, useResource,
adminSchema, navConfig, adminNav and src/data/*) and points imports,
comments and the seed script's module paths at the new names. Their
types now come from inference; no .d.ts files and no shape
interfaces.
tsc stays strict (noImplicitAny off). The errors inference leaves
behind get the lightest fix that clears them: `any` on empty state,
contexts and list defaults, `: any` on components with optional or
spread props, class fields on ApiError, and option shapes on
get/useResource.
Kept as real types, since they belong to modules that were already
TypeScript and later features import them: PageShell's ShellSection
and props, useContent's corrected record types (website/email/
instagram are bare strings) and EventListItem, and TimelineRef's
orgKind.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>