{"catalogRevision":"cat_726f873af6f566cc","recipeId":"page:guides:axum:schema-changes","recipeRevision":"r1","canonicalPath":"/guides/axum/schema-changes","label":"Apply database schema changes for Axum","title":"How to run database migrations for an Axum app on Ample","family":"Framework operation","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.","representativeQueries":["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."],"breadcrumbIds":["discovery","stack","stack:frameworks","stack:framework-axum","page:guides:axum:schema-changes"],"breadcrumbs":[{"id":"discovery","label":"Agent hosting discovery","canonicalPath":"/discover/discovery","kind":"root"},{"id":"stack","label":"Frameworks and execution targets","canonicalPath":"/discover/stack","kind":"facet"},{"id":"stack:frameworks","label":"Frameworks","canonicalPath":"/discover/stack/frameworks","kind":"group"},{"id":"stack:framework-axum","label":"Axum","canonicalPath":"/discover/stack/framework-axum","kind":"atom"},{"id":"page:guides:axum:schema-changes","label":"Apply database schema changes for Axum","canonicalPath":"/guides/axum/schema-changes","kind":"recipe"}],"parentIds":["stack:framework-axum","intent:configure-deployment","pattern:transactional-workflows"],"parents":[{"id":"stack:framework-axum","label":"Axum","canonicalPath":"/discover/stack/framework-axum","kind":"atom"},{"id":"intent:configure-deployment","label":"Configure deployment","canonicalPath":"/discover/intent/configure-deployment","kind":"atom"},{"id":"pattern:transactional-workflows","label":"Transactional workflows","canonicalPath":"/discover/pattern/transactional-workflows","kind":"atom"}],"resourceRequirements":["primitive:compute","primitive:postgres"],"infrastructureRequirements":[{"primitiveId":"primitive:compute","label":"Compute","canonicalPath":"/discover/primitive/compute","status":"verified","summary":"Apps run in isolated x86_64 Firecracker microVMs; sizes are the priced VM sizes."},{"primitiveId":"primitive:postgres","label":"Postgres","canonicalPath":"/discover/primitive/postgres","status":"verified","summary":"Managed PostgreSQL 16 with pgvector runs in its own microVM and is auto-provisioned when an app needs a database and no DATABASE_URL is supplied."}],"framework":"Axum","workload":"Apply database schema changes","releaseStatus":"published","supportStatus":"verified","executionStatus":"ready","docsOnly":false,"prerequisites":["An 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"],"testedConfiguration":{"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$//')"},"inputSchema":{"additionalProperties":false,"properties":{"env":{"description":"Encrypted environment variables","items":{"pattern":"^[A-Z][A-Z0-9_]*=.*$","type":"string"},"maxItems":50,"type":"array"},"name":{"description":"App name","maxLength":63,"minLength":1,"pattern":"^[a-z0-9-]+$","type":"string"},"path":{"description":"Project directory or ample.toml service","maxLength":512,"minLength":1,"type":"string"},"release_command":{"description":"Migration command run before activation","maxLength":512,"type":"string"}},"required":["name","path","release_command"],"type":"object"},"outputSchema":null,"workflowSteps":[{"title":"Build and start","body":"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."},{"title":"Run migrations as the release command","body":"Ample runs the command before activation and fails the release if it exits non-zero; keep migrations idempotent.","command":"ample deploy . --name <app-name> --public --release-command \"python3 migrate.py\""},{"title":"Verify","body":"Fetch the live URL and /p/migrated on the example; on failure read the build and runtime logs.","command":"ample logs <deployment_id> --kind build"}],"examples":[{"title":"Axum pattern fixture","description":"Verified schema changes on Axum.","sourceRef":"tests/deploy-canaries/axum-patterns"}],"successChecks":[{"description":"app responds on its public URL","kind":"http_get","path":"/","expect":"ample canary axum patterns"},{"description":"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-2gb.","Managed PostgreSQL 16 with pgvector."],"costEstimate":{"currency":"USD","monthlyAmount":10.0,"authoritative":true,"basis":"size prices from pricing.toml (loaded by the API) at build revision 3a3dfe06151688a20d397caac2aa66e562c23eb0","components":[{"name":"app server","size":"s-1vcpu-1gb","quantity":1.0,"monthlyAmount":5.0},{"name":"managed PostgreSQL database","size":"s-1vcpu-1gb","quantity":1.0,"monthlyAmount":5.0}],"note":"Upper-bound monthly price of the tested sizes. Buckets are allocation-priced per quota and not included."},"evidenceSummary":[{"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).","observedAt":"2026-11-05T22:38:23Z","implementationRevision":"da3e37255e5a","expiresAt":"2027-05-04T22:38:23Z","scope":{"checks":["/p/migrated"],"template":"ubuntu-24.04"}}],"lastVerifiedAt":"2026-11-05T22:38:23Z","mcpBinding":{"registryRef":"mcp:ample_deploy","toolName":"ample_deploy","schemaHash":"0802c329be823fa0695460cf73206d47a6fa0efa57417c386c34b6614a92ea5f","observedAt":"2026-11-06T06:16:17.558478534+00:00","implementationRevision":"4558e9477d09","requiredScopes":["servers:write","databases:read"],"bindingState":"current"},"unknowns":[],"formats":{"html":"https://ample.computer/guides/axum/schema-changes","markdown":"https://ample.computer/guides/axum/schema-changes.md","json":"https://api.ample.computer/v1/catalog/recipes/page%3Aguides%3Aaxum%3Aschema-changes"},"nextActions":[{"actionId":"browse-catalog","label":"Browse the catalog index","operationId":"catalog_index","method":"GET","relativePath":"/v1/catalog","origin":"api","parameters":{},"requiresAuthentication":false,"requiresApproval":false},{"actionId":"search-recipes","label":"Search published recipes by intent, stack and constraints","operationId":"search_recipes","method":"POST","relativePath":"/v1/catalog/search","origin":"api","parameters":{"body":{"limit":5,"query":"Apply database schema changes for Axum"}},"requiresAuthentication":false,"requiresApproval":false},{"actionId":"plan:page:guides:axum:schema-changes","label":"Prepare a side-effect-free deployment plan for an authorized project","operationId":"plan_deployment","method":"POST","relativePath":"/v1/catalog/plan","origin":"api","parameters":{"body":{"inputs":{},"projectId":"<workspace or server id you own>","recipeId":"page:guides:axum:schema-changes","recipeRevision":"r1"}},"requiresAuthentication":true,"requiresApproval":false},{"actionId":"auth-setup","label":"Read the existing agent authentication setup","operationId":"existing_auth_setup","method":"GET","relativePath":"/mcp/setup","origin":"api","parameters":{},"requiresAuthentication":false,"requiresApproval":false},{"actionId":"browse:stack:framework-axum","label":"Browse Axum","operationId":"browse_node","method":"GET","relativePath":"/v1/catalog/nodes/stack%3Aframework-axum","origin":"api","parameters":{"nodeId":"stack:framework-axum"},"requiresAuthentication":false,"requiresApproval":false},{"actionId":"browse:intent:configure-deployment","label":"Browse Configure deployment","operationId":"browse_node","method":"GET","relativePath":"/v1/catalog/nodes/intent%3Aconfigure-deployment","origin":"api","parameters":{"nodeId":"intent:configure-deployment"},"requiresAuthentication":false,"requiresApproval":false},{"actionId":"browse:pattern:transactional-workflows","label":"Browse Transactional workflows","operationId":"browse_node","method":"GET","relativePath":"/v1/catalog/nodes/pattern%3Atransactional-workflows","origin":"api","parameters":{"nodeId":"pattern:transactional-workflows"},"requiresAuthentication":false,"requiresApproval":false}]}