b771c3d497
- 026_geometry_11_hub.sql: hub geometry-11 (cyan, 11 параграфов) + 4 раздела
(Призма и цилиндр, Пирамида и конус, Сфера и шар, Повторение).
- frontend/js/g3d.js: мини-3D движок для стереометрии.
Векторная математика, матрицы 3x3, перспективная + изометрическая проекции,
меши призмы/пирамиды/цилиндра/конуса, wireframe сферы, back-face culling
через нормали, Z-sort, drag-to-rotate (mouse + touch), preset views.
- frontend/textbooks/geometry_11_hub.html: hub с палитрой cyan/sky,
4 карточками разделов, аккордеон финала курса (placeholder Phase 5).
- frontend/textbooks/geometry_11_ch{1..4}.html: skeleton 4 разделов
(через gen_geom11_chapters.js). Все включают: помощники KaTeX, SVG 2D
(axes2D/plotFunc/pointWithDrop/asymptote/rightAngleMark/angleArcAuto/unitVec),
ICONS, makeCard, setupSorter, gcd, wireReadBtn, secNav, search, sidebar,
GEOM11 POLISH CSS + JS, подключение /js/g3d.js. STUB builder для всех 11
параграфов + 4 финалов с demo-G3D viewer (призма/цилиндр/пирамида/конус/
сфера-wireframe).
Versioned migrations
Each schema change is a separate .sql file, applied in alphabetical order.
Applied files are tracked in the _migrations table.
Applying migrations
npm run migrate # apply pending migrations (safe to re-run)
npm run migrate:bootstrap # mark 000_baseline.sql as applied on existing DB (run ONCE per env)
npm run migrate:legacy # run legacy migrate.js (kept for reference, do not use)
Naming convention
NNN_short_description.sql
Examples: 001_add_user_avatar.sql, 002_drop_unused_columns.sql
To find the next number:
ls backend/src/db/migrations/*.sql | sort -r | head -1
Rules
- Never edit a migration file after it has been committed and deployed.
- To revert: write a new migration that undoes the change.
- Each file must be valid SQLite SQL (not PostgreSQL — no SERIAL, no EXTENSION).
- Use
IF NOT EXISTS/IF EXISTSwhere possible for safety. - Test on a copy of the prod DB before deploying.
Deploy order (first time on a new environment)
npm run migrate:legacy # initialize full schema (existing init script)
npm run seed:permissions # seed default permissions and achievements
npm run migrate:bootstrap # mark 000_baseline.sql as applied
npm run migrate # apply any newer migrations (should say "nothing to apply")
npm start
Adding a new migration
# 1. Create the file
echo "ALTER TABLE users ADD COLUMN avatar_url TEXT;" > backend/src/db/migrations/001_add_avatar_url.sql
# 2. Apply and verify
npm run migrate
# 3. Commit
git add backend/src/db/migrations/001_add_avatar_url.sql
git commit -m "db: add avatar_url column to users"
Files
| File | Description |
|---|---|
000_baseline.sql |
Snapshot of full schema as of 2026-05-06. Never runs on existing DBs. |