## Apply database schema changes for Rails

### Summary
Schema changes for a Rails app on Ample. Verified on Rails: a --release-command migration ran before activation and its marker was readable by the live app (migrated=release-ok). Build and start: bundle install into vendor/bundle from Gemfile.lock (development and test groups skipped), then Puma via `rails server` reading PORT on the ruby-3.4 template with RAILS_ENV=production.

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

### Resource Requirements
- primitive:compute
- primitive:postgres

### Infrastructure Requirements
1. **Compute**:
   - Apps run in isolated x86_64 Firecracker microVMs that auto-pause when idle and wake on request; sizes are the priced VM sizes.
2. **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.

### Framework
Rails

### Workload
Apply database schema changes

### Release Status
Published

### Support Status
Verified

### Execution Status
Ready

### Prerequisites
- A Rails project (bundle install into vendor/bundle from Gemfile.lock (development and test groups skipped), then Puma via `rails server` reading PORT on the ruby-3.4 template with RAILS_ENV=production)
- A PostgreSQL driver reading DATABASE_URL at runtime
- An Ample account token with servers:write, databases:read

### Workflow Steps
1. **Build and start**:
   - bundle install into vendor/bundle from Gemfile.lock (development and test groups skipped), then Puma via `rails server` reading PORT on the ruby-3.4 template with RAILS_ENV=production; 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
- **Rails pattern fixture**:
  - Verified schema changes on Rails. Reference: `tests/deploy-canaries/rails-patterns`

### Success Checks
1. **App responds on its public URL**:
   - Expect: ample canary rails patterns
2. **Migrated check from the example**:
   - Expect: see the pattern fixture checks

### Limitations
- Verified on the ruby-3.4 template at s-1vcpu-1gb; other sizes and Rails 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
- Authoritative: true
- Basis: size prices from pricing.toml (loaded by the API) at build revision 1ac5595375130d45290090e82ed0f554ccd45405-dirty
- Components:
  1. **App server**:
     - Size: s-1vcpu-1gb
     - Quantity: 1.0
     - Monthly Amount: 5.0
  2. **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
- **Canary run**:
   - Summary: Rails pattern fixture deployed on Ample.
   - Observed At: 2026-09-20T21:55:28Z
   - Implementation Revision: 4f7cb9813c1f-dirty (CLI 4f7cb98)
   - Expires At: 2027-03-19T21:55:28Z
   - Scope: checks, template: ruby-3.4

### Last Verified At
2026-09-20T21:55:28Z

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

### Formats
- **HTML**: https://ample.computer/guides/rails/schema-changes
- **Markdown**: https://ample.computer/guides/rails/schema-changes.md
- **JSON**: https://api.ample.computer/v1/catalog/recipes/page%3Aguides%3Arails%3Aschema-changes

### Next Actions
1. **Browse the catalog index**
   - Operation ID: catalog_index
   - Method: GET
   - Relative Path: /v1/catalog
   - Requires Authentication: false
2. **Search published recipes by intent, stack and constraints**
   - Operation ID: search_recipes
   - Method: POST
   - Relative Path: /v1/catalog/search
   - Requires Authentication: false
   - Parameters: Limit: 5, Query: Apply database schema changes for Rails
3. **Prepare a side-effect-free deployment plan for an authorized project**
   - Operation ID: plan_deployment
   - Method: POST
   - Relative Path: /v1/catalog/plan
   - Requires Authentication: true
4. Additional browsing options related to frameworks and deployment configurations.
