# Apply Database Schema Changes for Echo

Schema changes for a Echo app on Ample. Verified on Echo: a --release-command migration ran before activation and its marker was readable by the live app (migrated=release-ok). Build and start: CGO_ENABLED=0 go build -o app ./... then ./app on the ubuntu-24.04 template (go.sum committed for a reproducible build).

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

## Resource Requirements
- primitive:compute
- primitive: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.

## Prerequisites
- A Echo project (CGO_ENABLED=0 go build -o app ./... then ./app on the ubuntu-24.04 template (go.sum committed for a reproducible build))
- A PostgreSQL driver reading DATABASE_URL at runtime
- An Ample account token with servers:write, databases:read

## Workflow Steps
1. **Build and start**: CGO_ENABLED=0 go build -o app ./... then ./app on the ubuntu-24.04 template (go.sum committed for a reproducible build); 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 "./app migrate"`
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
- **Echo pattern fixture**: Verified schema changes on Echo. Source Reference: tests/deploy-canaries/echo-patterns.

## Success Checks
1. App responds on its public URL. Kind: http_get; Path: /; Expect: ample canary echo patterns.
2. Migrated check from the example. Kind: http_get; Path: /p/migrated; Expect: see the pattern fixture checks.

## Limitations
- Verified on the ubuntu-24.04 template at s-1vcpu-1gb; other sizes and Echo 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
- **Note**: Always-on monthly price of the tested sizes; apps auto-pause when idle. Buckets are allocation-priced per quota and not included.
  - **Components**:
    - App server: s-1vcpu-1gb, Quantity: 1.0, Monthly Amount: 5.0
    - Managed PostgreSQL database: s-1vcpu-1gb, Quantity: 1.0, Monthly Amount: 5.0

## Evidence Summary
1. **Canary Run**: Echo pattern fixture deployed on Ample (CGO_ENABLED=0 go build -o app ./... then ./app on the ubuntu-24.04 template (go.sum committed for a reproducible build)); 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:34:39Z
   - Implementation Revision: 1d28ae0-dirty (CLI 0.1.21)
   - Expires At: 2027-03-20T02:34:39Z
   - Scope: checks ['/p/migrated'], template: 'ubuntu-24.04'

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

## Next Actions
- **Browse the catalog index**: GET /v1/catalog
- **Search published recipes by intent, stack and constraints**: POST /v1/catalog/search
- **Prepare a side-effect-free deployment plan for an authorized project**: POST /v1/catalog/plan
- **Read the existing agent authentication setup**: GET /mcp/setup
- **Browse Echo**: GET /v1/catalog/nodes/stack%3Aframework-echo
- **Browse Configure deployment**: GET /v1/catalog/nodes/intent%3Aconfigure-deployment
- **Browse Transactional workflows**: GET /v1/catalog/nodes/pattern%3Atransactional-workflows
