feat(server): convert legacy style rules with a manual script instead of at startup

The conversion of stored legacy style rules to Semantic CSS no longer runs
when the server starts. The image now ships
apps/server/dist/migrate-legacy-styles.mjs, run by hand against
DATABASE_URL:

- without flags it's a dry run that converts in memory and reports counts
- --apply --backup <file> converts, appending every replaced stylesheet to
  the backup file before its row is written
- --restore <file> puts those stylesheets back, except on rows edited since

Each table is scanned once for the rows that need converting, then they're
converted in batches with progress logged. Only metadata.stylesheet is
rewritten, a row whose stylesheet changed after it was read is left alone,
and running it again skips what's converted. The data_migration table that
recorded the startup run is gone. The self-hosting guide explains the
one-time run.
This commit is contained in:
Amruth Pillai
2026-09-29 16:57:21 +02:00
parent 677ff17c1f
commit 92459122c5
9 changed files with 216 additions and 7256 deletions
+25
View File
@@ -459,6 +459,31 @@ through your managed provider, then follow that image's, host's, or provider's u
and verify that the backup can be restored before a major-version upgrade. Pulling a new app image and running app
migrations do not upgrade the PostgreSQL server.
### Converting styles from the old style editor (one time)
Resumes and cover letters styled with the old style editor (before Custom Styles became CSS) keep those styles only once
they're converted to Custom Styles. The conversion isn't run automatically: after updating to the first version without
the old editor, run it once from the app container. It uses the container's `DATABASE_URL`.
1. **Dry run.** Converts every affected resume in memory and reports the counts; nothing is written.
```bash
docker compose exec reactive-resume node apps/server/dist/migrate-legacy-styles.mjs
```
2. **Convert.** Every replaced stylesheet is saved to the backup file first. Only the stylesheet of each resume or letter
changes, and running it again (for example after an interruption) skips what's already converted.
```bash
docker compose exec reactive-resume node apps/server/dist/migrate-legacy-styles.mjs --apply --backup /app/data/legacy-styles-backup.ndjson
```
3. **Undo, if needed.** Puts back the recorded stylesheets, except on resumes edited since.
```bash
docker compose exec reactive-resume node apps/server/dist/migrate-legacy-styles.mjs --restore /app/data/legacy-styles-backup.ndjson
```
## Backups (recommended)
Reactive Resume stores data in two places: the PostgreSQL database and file uploads (either local storage or S3). Back up both on a regular schedule.