Flatten database schemas (`.faproject`)
When to use
- Pre-release / dev-only resets when incremental migrations not worth keeping
- User explicitly asks to flatten or squash migrations
- Do not flatten after public release without migration strategy for user data
Live repo today
- Supported max
FA_PROJECT_USER_VERSION_SUPPORTED_MAX = 6— projectDB.md - Flatten = dev procedure that resets ladder to bootstrap 1 (below), not current shipped state
Target after flatten (procedure outcome)
PRAGMA user_version1 only shipped revisionFA_PROJECT_USER_VERSION_SUPPORTED_MAX = 1infaProjectDbMigrateWiring.ts- Fresh: 0 → bootstrap → 1 + default world seed
- At 1:
applyFaProjectMigrationsno-op (or idempotent patches only) - Other versions: unsupported (throws)
Flatten procedure (checklist)
- Read docs/database/projectDB.md; list tables/columns/indexes to keep
- Merge DDL into
faProjectDbSchemaDdl.ts(applyFaProjectProjectDataSchemaV1,applyFaProjectContentSchemaV1) - Simplify
faProjectDbMigrateWiring.ts— max version 1, remove legacy steps - Delete obsolete migration-only helpers
- Rewrite
_tests/faProjectDbMigrate.vitest.test.ts; update DDL tests - Docs: projectDB.md, templateCustomFields.md, AGENTS.md, README.md if needed
- Changelog: older dev
.faprojectmust be recreated (currentpackage.jsonversion only) - Full
yarn testbatch:verifybefore commit (schema squash touches electron + docs + broad tests)
Adding migrations again (after flatten)
- Bump
FA_PROJECT_USER_VERSION_SUPPORTED_MAX - Add
applyFaProjectContentSchemaV2ormigrateProjectDataV1ToV2 - Chain in
applyFaProjectMigrations - Update projectDB.md + tests
No long historical ladder unless real user upgrades require it.
Related
Types
Shared types → types/. See types-folder.mdc.