page:guides:gin:schema changes

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

Resource Requirements

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

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

Success Checks

Limitations

Cost Estimate

Next Actions

Evidence Summary