# Apply Database Schema Changes for Gin

## Summary
Schema changes for a Gin app on Ample. Verified on Gin: 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 Gin
- Where can I host Apply database schema changes built with Gin?
- 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.

## Prerequisites
- A Gin 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
### Gin Pattern Fixture
- **Description:** Verified schema changes on Gin.
- **Source Reference:** tests/deploy-canaries/gin-patterns

## Success Checks
- **App responds on its public URL**: Check the path `/` expecting to see "ample canary gin patterns".
- **Migrated check from the example**: Check the path `/p/migrated` expecting to see the pattern fixture checks.

## Limitations
- Verified on the ubuntu-24.04 template at s-1vcpu-1gb; other sizes and Gin 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**: s-1vcpu-1gb, quantity: 1.0, monthly amount: 5.0  
  - **Managed PostgreSQL database**: s-1vcpu-1gb, quantity: 1.0, monthly amount: 5.0  
- **Note:** Always-on monthly price of the tested sizes; apps auto-pause when idle.

## Next Actions
- **[Browse the catalog index](https://api.ample.computer/v1/catalog)**
- **[Search published recipes by intent, stack and constraints](https://api.ample.computer/v1/catalog/search)**
- **[Prepare a side-effect-free deployment plan](https://api.ample.com/computer/v1/catalog/plan)**
- **[Read the existing agent authentication setup](https://api.ample.com/mcp/setup)**
- **[Browse Gin](https://api.ample.com/v1/catalog/nodes/stack%3Aframework-gin)**
- **[Browse Configure deployment](https://api.ample.com/v1/catalog/nodes/intent%3Aconfigure-deployment)**
- **[Browse Transactional workflows](https://api.ample.com/v1/catalog/nodes/pattern%3Atransactional-workflows)**

## Evidence Summary
- **Kind:** canary_run  
- **Summary:** Gin 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)).
- **Observed At:** 2026-09-21T01:15:54Z  
- **Implementation Revision:** 50dbac567d2c5cc8e55e6c748a646be0025d9cfb-dirty (CLI 0.1.21)  
- **Expires At:** 2027-03-20T01:15:54Z  
- **Scope:** Check /p/migrated on the template ubuntu-24.04.
