- Step 13: AdminTransfersPage, LazyAdminTransfers, route /admin/transfers - Step 14: MSW handlers admin transfers - Step 15: AdminTransfersView stories (Default, Empty, WithFailedTransfers, Error, Loading) - Step 16-17: DeepHealth handler (disk, config), GET /health/deep - Step 19: health_deep_test.go (4 tests) - Step 20: docs/API_REFERENCE.md - Step 21: Archive V0_604, MIGRATIONS.md migration 116 - Step 22: CHANGELOG, PROJECT_STATE, FEATURE_STATUS v0.701 - Step 23: RETROSPECTIVE_V0701, V0_702 placeholder, SCOPE_CONTROL, .cursorrules - Step 24: Archive V0_701_RELEASE_SCOPE - Fix: AdminTransfersView Select component (use options API)
1.6 KiB
1.6 KiB
Database Migrations
Overview
Veza uses SQL migrations stored in veza-backend-api/migrations/. Migrations are applied in order by filename (lexicographic sort).
Migration Naming
- Format:
NNN_description.sql(e.g.101_product_reviews.sql) - Use snake_case for descriptions
- Down migrations (rollback):
NNN_description_down.sqlwhen needed
Squash Script
The scripts/squash_migrations.sh script generates a baseline SQL file that concatenates all migrations into a single file. This is useful for:
- Fresh database setup
- Creating a clean baseline for new environments
- Versioned releases (e.g.
baseline_v0601.sql)
Usage
# From project root
./scripts/squash_migrations.sh
Output: veza-backend-api/migrations/baseline_v0601.sql
Procedure
- Run the script after adding new migrations
- Update the version in the script (e.g.
baseline_v0601.sql) for each release - Update the migration range comment (e.g.
001-113) to reflect the latest migration number - The baseline file is auto-generated; do not edit it manually
Recent Migrations
| # | File | Description |
|---|---|---|
| 116 | 116_seller_transfers_retry.sql |
v0.701: Add retry_count, next_retry_at to seller_transfers; index for failed retries |
Adding New Migrations
- Create a new file:
veza-backend-api/migrations/NNN_description.sql - Use the next available number (check existing migrations)
- Write idempotent SQL when possible (e.g.
IF NOT EXISTS) - Test locally before committing
- Run
squash_migrations.shto update the baseline for the release