# Apply database schema changes for Axum

## Summary
Schema changes for a Axum app on Ample. Verified on Axum: a --release-command migration ran before activation and its marker was readable by the live app (migrated=release-ok). Build and start: `cargo build --release` in the rust builder image (stable toolchain, Cargo.lock committed, pure-Rust dependencies), then the release binary on the ubuntu-24.04 template reading PORT and DATABASE_URL.

## Representative Queries
- Apply database schema changes for Axum
- Where can I host Apply database schema changes built with Axum?
- I need a framework-specific schema migration and rollback procedure; no managed migration service is assumed.

## Resource Requirements
- **Compute**
- **Postgres**

## Infrastructure Requirements
- **Compute**: Apps run in isolated x86_64 Firecracker microVMs that auto-pause when idle and wake on request; sizes are the priced VM sizes.
- **Postgres**: Managed PostgreSQL 16 runs in its own microVM and is auto-provisioned when an app needs a database and no DATABASE_URL is supplied.

## Workload
**Apply database schema changes**

## Release Status
**Published**

## Support Status
**Verified**

## Execution Status
**Ready**

## Prerequisites
- A Axum project (`cargo build --release` in the rust builder image (stable toolchain, Cargo.lock committed, pure-Rust dependencies), then the release binary on the ubuntu-24.04 template reading PORT and DATABASE_URL).
- A PostgreSQL driver reading DATABASE_URL at runtime.
- An Ample account token with servers:write, databases:read.

## Test Configuration
### Template
`ubuntu-24.04`
### Runtime
`rust`
### Size
`s-1vcpu-2gb`
### Build
`cargo build --release`
### Start
`./$(ls target/release/*.d | grep -v '/lib' | head -n 1 | sed 's/\.d$//')`

## Workflow Steps
1. **Build and start**: `cargo build --release` in the rust builder image (stable toolchain, Cargo.lock committed, pure-Rust dependencies), then the release binary on the ubuntu-24.04 template reading PORT and DATABASE_URL; the server must bind 0.0.0.0 on PORT.
2. **Run migrations as the release command**: Ample runs the command before activation and fails the release if it exits non-zero; keep migrations idempotent.
   Command: `ample deploy . --name  --public --release-command "python3 migrate.py"`
3. **Verify**: Fetch the live URL and /p/migrated on the example; on failure read the build and runtime logs.
   Command: `ample logs  --kind build`

## Examples
- **Axum pattern fixture**: Verified schema changes on Axum. Source: `tests/deploy-canaries/axum-patterns`

## Success Checks
- App responds on its public URL: **GET** `/` expect: `ample canary axum patterns`
- Migrated check from the example: **GET** `/p/migrated` expect: `see the pattern fixture checks`

## Limitations
- Verified on the ubuntu-24.04 template at s-1vcpu-2gb; other sizes and Axum major versions are not verified.
- Region, compliance attestations and request-duration limits are unknown and not claimed.
- Managed PostgreSQL 16 only; extensions, connection limits and backup or restore procedures are not verified.

## Cost Estimate
- **Currency**: USD
- **Monthly Amount**: 10.0
- **Basis**: Size prices from pricing.toml (loaded by the API) at build revision 1ac5595375130d45290090e82ed0f554ccd45405-dirty
- **Components**:
  - App server: size `s-1vcpu-1gb`, quantity 1.0, monthly amount 5.0
  - Managed PostgreSQL database: size `s-1vcpu-1gb`, quantity 1.0, monthly amount 5.0
- **Note**: Always-on monthly price of the tested sizes; apps auto-pause when idle. Buckets are allocation-priced per quota and not included.

## Evidence Summary
- **Kind**: canary_run
- **Summary**: Axum pattern fixture deployed on Ample (cargo build --release in the rust builder image (stable toolchain, Cargo.lock committed, pure-Rust dependencies), then the release binary on the ubuntu-24.04 template reading PORT and DATABASE_URL); for this guide: a --release-command migration ran before activation and its marker was readable by the live app (migrated=release-ok).
- **Observed At**: 2026-09-21T02:46:37Z
- **Implementation Revision**: 1d28ae0-dirty (CLI 0.1.21)
- **Expires At**: 2027-03-20T02:46:37Z
- **Scope**: check `/p/migrated`, template: `ubuntu-24.04`

## Unknowns
- Region availability is unknown until a verified region fact is recorded
- Compliance attestations are unknown; none are claimed.

## Formats
- **HTML**: [ample.computer/guides/axum/schema-changes](/content/guides/axum/schema-changes/index.html)
- **Markdown**: [ample.computer/guides/axum/schema-changes.md](/content/guides/axum/schema-changes.md)
- **JSON**: [api.ample.computer/v1/catalog/recipes/page%3Aguides%3Aaxum%3Aschema-changes](https://api.ample.computer/v1/catalog/recipes/page%3Aguides%3Aaxum%3Aschema-changes)

## Next Actions
1. **Browse the catalog index**: GET `/v1/catalog`
2. **Search published recipes by intent, stack and constraints**: POST `/v1/catalog/search` with body `{ "limit": 5, "query": "Apply database schema changes for Axum" }`
3. **Prepare a side-effect-free deployment plan for an authorized project**: POST `/v1/catalog/plan` with body `{ "inputs": {}, "projectId": "", "recipeId": "page:guides:axum:schema-changes", "recipeRevision": "r1" }`
4. **Read the existing agent authentication setup**: GET `/mcp/setup`
5. **Browse Axum**: GET `/v1/catalog/nodes/stack%3Aframework-axum`
6. **Browse Configure deployment**: GET `/v1/catalog/nodes/intent%3Aconfigure-deployment`
7. **Browse Transactional workflows**: GET `/v1/catalog/nodes/pattern%3Atransactional-workflows`
