mirror of
https://github.com/gadgethd/ukmesh.git
synced 2026-09-09 08:43:45 +00:00
- split backend API into route/service/repository boundaries across stats, owner, and pathing\n- extract shared API bootstrap and helper modules\n- reduce MapLibreMap into smaller frontend map modules with extracted builders, config, popup UI, and types\n- continue worker modularization by extracting RF terrain/tile helpers alongside RF config and loss helpers\n- add repo-local architecture, DB lifecycle, link model, pathing, frontend map, and contributing docs\n\nThis is the verified refactor checkpoint: backend and frontend builds passed, worker syntax checks passed, affected containers were rebuilt, and /healthz is OK.
917 B
917 B
DB Lifecycle
Rules
backend/src/db/schema/base.sql- only cheap, idempotent base schema work
backend/src/db/migrations.ts- runs additive versioned migrations
- historical backfills must not run on backend startup
Use the right layer
Base schema
Use for:
- table creation
- index creation
- safe
ALTER TABLE ... ADD COLUMN IF NOT EXISTS
Do not use for:
- whole-table
UPDATEbackfills - historical recomputation
- data repair
Migrations
Use for:
- additive schema changes that need one-time application
- constraints or indexes that belong to a versioned rollout
Backfills / maintenance jobs
Use for:
- recomputing derived packet fields
- rebuilding link tables
- recalculating historical summaries
Startup guarantee
Backend startup should be safe against a production-sized database. If a change can lock or scan large tables, it does not belong in startup schema init.