feat(migrations): split 1688-line initial schema into per-feature files (PMS-128) #66
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/pms-128-migration-split"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
migrations/001_initial_schema.sqlmonolith into 16 per-feature files (002_tenants...017_settings) so each future feature module adds its own migration without touching others. Closes cross-cutting issue F14 fromdev-docs/codebase-state.md.002_seed_data) so they continue to run after every table they touch exists. New tail:018_user_oauth_identities...022_rmm_mesh_central_provider, then023_seed_data, then024_triggers_and_rls.updated_attrigger function and the dynamic RLS-enableDO $$ ... $$blocks from the tail of the old monolith into024_triggers_and_rls.sql. Keeping them dynamic (vs hand-rolling triggers per file) means any future feature can add a table withtenant_id/updated_atand inherit both behaviors without touching024. Cost: the loop now also scans tables added in018+; the one such table (user_oauth_identities) has neither column so it is correctly skipped.Breaking change
_sqlx_migrationson any non-fresh database only knows about the old001+002_seed_data+003-007. After this PR,sqlx::migrate!will refuse to start against such a DB. The dev compose stack wipes volumes viajust dev-clean; CI uses fresh per-test databases via#[sqlx::test]. Both flows work without intervention. Anyone with a long-lived local DB shouldjust dev-clean(or drop + recreate the DB) before pulling.Test plan
cargo fmt --all --checkcargo clippy --all-targets -- -D warningscargo check --all-targetsauth,contacts,tenants,tickets,time_tracking,notifications,rmm,dispatch_stub).just dev-clean && just dev && just migrate-runsucceeds end-to-end.Closes PMS-128.