Example: testing a migration before production
A team hosts an API and its PostgreSQL database on ERHA Cloud, with previews set to an anonymised copy of production. A task adds a column to a table.
- The agent writes the migration and opens the merge request. The runner has no database, so the migration is written without being run.
- ERHA creates the merge request's preview, with an anonymised copy of the production database.
- The deploy hook in the .erha/config.yaml file runs the migration in the preview.
- The team tests the preview, reviews and merges, after which the preview and its database are deleted.
Outcome
The migration ran on an anonymised copy of production before the release.