# Postgres migrations

A step of the [Cloud application](https://gradus.kazet.blog/tree/cloud-application) tree on Gradus, in the Data & storage area: DB, cache, queues.

Page: https://gradus.kazet.blog/tree/cloud-application/step/db-postgres-migrations

Add a migration tool, write the first schema from the first journey and run migrations on every deploy before the new revision takes traffic.

One option of Database: Managed Postgres. The others: Document database.

Usually comes after: [Managed Postgres](https://gradus.kazet.blog/tree/cloud-application/step/db-postgres-provision).

## Prompt for your AI assistant

```
Add a migration tool for Postgres to this service, write the first migration with the tables the first journey in docs/product/mvp.md needs and run pending migrations in the deploy workflow before the new revision takes traffic, failing the deploy if a migration fails. Document how to write and run a migration in docs/.
```

Every step of the tree: https://gradus.kazet.blog/tree/cloud-application/llms.txt
