Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Build Mastra AI agents and workflows with guidance on current API lookup, tools, memory, and RAG patterns.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/migration-guide.md
1# Migration Guide23Guide for upgrading Mastra versions using official documentation and current API verification.45## Migration strategy67For version upgrades, follow this process:89### 1. Check official migration docs1011**Always start with the official migration documentation:** `https://mastra.ai/llms.txt`1213Look for the **Migrations** or **Guides** section, which will have:1415- Breaking changes for each version16- Automated migration tools17- Step-by-step upgrade instructions1819**Example sections to look for:**2021- `/guides/migrations/upgrade-to-v1/`22- `/guides/migrations/upgrade-to-v2/`23- Breaking changes lists2425### 2. Use embedded docs for current APIs2627After identifying breaking changes, verify the new APIs:2829**Check your installed version:**3031```bash32cat node_modules/@mastra/core/dist/docs/assets/SOURCE_MAP.json | grep '"ApiName"'33cat node_modules/@mastra/core/dist/[path-from-source-map]34```3536See [`embedded-docs.md`](embedded-docs.md) for detailed lookup instructions.3738### 3. Use remote docs for latest info3940If packages aren't updated yet, check what APIs will look like: `https://mastra.ai/reference/[topic]`4142See [`remote-docs.md`](remote-docs.md) for detailed lookup instructions.4344## Quick migration workflow4546```bash47# 1. Check current version48npm list @mastra/core4950# 2. Fetch migration guide from official docs51# Use WebFetch: https://mastra.ai/llms.txt52# Find relevant migration section5354# 3. Update dependencies55npm install @mastra/core@latest @mastra/memory@latest @mastra/rag@latest mastra@latest5657# 4. Run automated migration (if available)58npx @mastra/codemod@latest v1 # or whatever version5960# 5. Check embedded docs for new APIs61cat node_modules/@mastra/core/dist/docs/assets/SOURCE_MAP.json6263# 6. Fix breaking changes using embedded docs lookup64# See embedded-docs.md for how to look up each API6566# 7. Test67npm run dev68npm test69```7071## Common migration patterns7273### Finding what changed7475**Check official migration docs:** `https://mastra.ai/guides/migrations/upgrade-to-v1/overview.md`7677This will list:7879- Breaking changes80- Deprecated APIs81- New features82- Migration tools8384### Updating API usage8586**For each breaking change:**87881. **Find the old API** in your code892. **Look up the new API** using embedded docs:90```bash91cat node_modules/@mastra/core/dist/docs/assets/SOURCE_MAP.json | grep '"NewApi"'92cat node_modules/@mastra/core/dist/[path]93```943. **Update your code** based on the type signatures954. **Test** the change9697### Example: Tool execute signature change9899**Official docs say:** "Tool execute signature changed"100101**Look up current signature:**102103```bash104cat node_modules/@mastra/core/dist/docs/assets/SOURCE_MAP.json | grep '"createTool"'105cat node_modules/@mastra/core/dist/tools/tool.d.ts106```107108**Update based on type definition:**109110```typescript111// Old (from docs)112execute: async (input) => { ... }113114// New (from embedded docs)115execute: async (inputData, context) => { ... }116```117118## Pre-migration checklist119120- [ ] Backup code (git commit)121- [ ] Check official migration docs: `https://mastra.ai/llms.txt`122- [ ] Note current version: `npm list @mastra/core`123- [ ] Read breaking changes list124- [ ] Tests are passing125126## Post-migration checklist127128- [ ] All dependencies updated together129- [ ] TypeScript compiles: `npx tsc --noEmit`130- [ ] Tests pass: `npm test`131- [ ] Studio works: `npm run dev`132- [ ] No console warnings133- [ ] APIs verified against embedded docs134135## Migration resources136137| Resource | Use For |138| -------------------------------------- | --------------------------------------------- |139| `https://mastra.ai/llms.txt` | Finding migration guides and breaking changes |140| [`embedded-docs.md`](embedded-docs.md) | Looking up new API signatures after updating |141| [`remote-docs.md`](remote-docs.md) | Checking latest docs before updating |142| [`common-errors.md`](common-errors.md) | Fixing migration errors |143144## Version-specific notes145146### General principles1471481. **Always update all @mastra packages together**149150```bash151npm install @mastra/core@latest @mastra/memory@latest @mastra/rag@latest mastra@latest152```1531542. **Check for automated migration tools**155156```bash157npx @mastra/codemod@latest [version]158```1591603. **Verify Node.js version requirements**161- Check official migration docs for minimum Node version1621634. **Run database migrations if using storage**164- Follow storage migration guide in official docs165166## Getting help1671681. **Check official migration docs**: `https://mastra.ai/llms.txt` → Migrations section1692. **Look up new APIs**: See [`embedded-docs.md`](embedded-docs.md)1703. **Check for errors**: See [`common-errors.md`](common-errors.md)1714. **Ask in Discord**: https://discord.gg/BTYqqHKUrf1725. **File issues**: https://github.com/mastra-ai/mastra/issues173174## Key principles1751761. **Official docs are source of truth** - Start with `https://mastra.ai/llms.txt`1772. **Verify with embedded docs** - Check installed version APIs1783. **Update incrementally** - Don't skip major versions1794. **Test thoroughly** - Run tests after each change1805. **Use automation** - Use codemods when available181