feat: add migration support for VPS deployment with backup functionality

This commit is contained in:
syntaxbullet
2026-07-09 16:06:02 +02:00
parent 1216a37049
commit d6f8f55c09
4 changed files with 86 additions and 1 deletions

View File

@@ -120,6 +120,34 @@ If the Caddy container also needs to be recreated:
DEPLOY_CADDY=1 pnpm deploy:vps
```
## Payload Migrations
Routine deploys do not run migrations. For schema-changing commits, create and
commit the Payload migration files, then deploy with migrations enabled:
```bash
RUN_MIGRATIONS=1 pnpm deploy:vps
```
That mode:
1. syncs the committed code
2. builds the new Docker image
3. stops the app container
4. copies `shared/content.db` to `backups/content-*-pre-migrate.db`
5. runs `pnpm payload migrate` in a one-off app container
6. starts the app container again
To run migrations against the already deployed code/image without syncing code:
```bash
pnpm vps:migrate
```
Run migrations only when the commit includes migration files under
`src/migrations/`. For plain frontend/content-rendering changes, use the normal
`pnpm deploy:vps` path.
## Status And Logs
```bash