Clean up the schema: drop unused tables, rename scopes, publishable awards

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>
This commit is contained in:
Zaldimmar 2026-09-26 17:09:58 -05:00
parent 8790f861fe
commit 25e592bfea
19 changed files with 339 additions and 423 deletions

View file

@ -27,8 +27,12 @@ const PLACE_FIELDS = [
{ path: "is_online", label: "Online", widget: "checkbox" },
];
const PUBLISHED_FIELD = { path: "is_published", label: "Published", widget: "checkbox" };
/* For entities whose lists the site orders by hand. Events sort by
date and people by sort_name, so they take PUBLISHED_FIELD alone. */
const PUBLISH_FIELDS = [
{ path: "is_published", label: "Published", widget: "checkbox" },
PUBLISHED_FIELD,
{ path: "sort_order", label: "Sort order", widget: "number" },
];
@ -392,14 +396,14 @@ const events = {
list: {
columns: [
{ key: "title", label: "Title", primary: true },
{ key: "section_id", label: "Scope" },
{ key: "scope_id", label: "Scope" },
{ key: "event_type", label: "Type" },
{ key: "date_label", label: "Dates" },
{ key: "status", label: "Status" },
{ key: "is_published", label: "Live", widget: "bool" },
],
filters: [
{ key: "section_id", label: "Scope", optionsFrom: "event_sections" },
{ key: "scope_id", label: "Scope", optionsFrom: "event_scopes" },
{
key: "event_type",
label: "Type",
@ -414,15 +418,11 @@ const events = {
{
legend: "Identity",
fields: [
// The column is still section_id — the rows in event_sections
// are what changed, not the schema. Only the label moved,
// because "scope" is what the field has always meant and
// "section" described where it happened to be rendered.
{
path: "section_id",
path: "scope_id",
label: "Scope",
widget: "select",
optionsFrom: "event_sections",
optionsFrom: "event_scopes",
required: true,
help: "Whose gathering this is. Only national, regional and partner appear on the Retreats page",
},
@ -477,7 +477,7 @@ const events = {
},
timelineGroup("event"),
timelineDetailGroup("event"),
{ legend: "Publishing", fields: PUBLISH_FIELDS },
{ legend: "Publishing", fields: [PUBLISHED_FIELD] },
],
children: [
@ -592,7 +592,7 @@ const people = {
{
legend: "Publishing",
note: "Unpublished people are invisible everywhere, including as chapter leads.",
fields: PUBLISH_FIELDS,
fields: [PUBLISHED_FIELD],
},
],
@ -757,10 +757,11 @@ const awards = {
{ key: "name", label: "Name", primary: true },
{ key: "org_id", label: "Awarded by" },
{ key: "description", label: "Description" },
{ key: "sort_order", label: "Order" },
{ key: "is_published", label: "Live", widget: "bool" },
],
filters: [
{ key: "org_id", label: "Awarded by", optionsFrom: "organizations" },
{ key: "is_published", label: "Published", options: [["1", "Live"], ["0", "Hidden"]] },
],
},
@ -782,9 +783,13 @@ const awards = {
{ path: "name", label: "Name", required: true },
{ path: "description", label: "Description", widget: "textarea", full: true },
{ path: "logo", label: "Logo", help: "Filename in public/org-logos/" },
{ path: "sort_order", label: "Sort order", widget: "number" },
],
},
{
legend: "Publishing",
note: "An unpublished award is a draft: off the site, and a 404 at its own page.",
fields: PUBLISH_FIELDS,
},
],
};