feat: add migration support for VPS deployment with backup functionality
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user