Migration Guide
How to upgrade your vertical application when the Vertical Template is updated.
Version Compatibility
| Template Version | Node.js | Next.js | @enterpriseaigroup/client |
|---|---|---|---|
| 2.x | 18+ | 15+ | 2.x |
| 1.x | 18+ | 14+ | 1.x |
Migration Process
Step 1: Check Current Version
# Check your current template version
cat package.json | grep version
# Check client package version
cat packages/client/package.json | grep version
Step 2: Review Release Notes
Before upgrading, review the CHANGELOG for:
- Breaking changes
- New features
- Deprecated APIs
- Required migration steps
Step 3: Create a Backup Branch
git checkout -b backup/pre-migration
git push origin backup/pre-migration
git checkout main
Step 4: Update Dependencies
# Update all dependencies
npm update
# Or update specific packages
npm update @enterpriseaigroup/client
Step 5: Run Migration Scripts (if provided)
# Check for migration scripts
ls scripts/migrations/
# Run migration script for specific version
npx tsx scripts/migrations/v2.0.0.ts
Common Migration Scenarios
Migrating Tenant Configurations
When the EAIConfig schema changes:
-
Check for TypeScript errors
npx tsc --noEmit -
Update tenant configs to match new schema:
// Before (v1.x)
export const config: EAIConfig = {
tenantId: 'my-tenant',
theme: {
primaryColor: '#6366f1',
},
};
// After (v2.x) - example with new required field
export const config: EAIConfig = {
tenantId: 'my-tenant',
displayName: 'My Tenant', // New required field
theme: {
primaryColor: '#6366f1',
},
}; -
Validate all configs:
npm run validate-config
Migrating Store Slices
When store slice structure changes:
- Update initialState to match new shape
- Update storeBindings in component configs
- Clear persisted state (if schema changed):
// In browser console or code
sessionStorage.clear();
Migrating Components
When component props change:
- Check ComponentRegistry for renamed components
- Update props in tenant configs:
// Before
{ component: 'OldComponentName', props: { oldProp: true } }
// After
{ component: 'NewComponentName', props: { newProp: true } }
Migrating API Routes
When API route patterns change:
- Update route files to new structure
- Update middleware usage
- Test all endpoints:
npm run test:api
Breaking Changes by Version
v2.0.0 (Example)
Breaking Changes:
EAIConfig.namerenamed toEAIConfig.displayNameuseStorehook renamed touseStoreValue- Removed deprecated
fetchWithAuth- use client package instead
Migration Steps:
- Find and replace
name:withdisplayName:in tenant configs - Find and replace
useStore(withuseStoreValue(in components - Replace
fetchWithAuthcalls with client package methods
Automated Migration:
# Run the v2 migration script
npx tsx scripts/migrations/v2.0.0.ts
Handling Merge Conflicts
When pulling template updates creates conflicts:
Config Files
# Keep your tenant configs, update types
git checkout --ours src/eai.config/tenants/
git checkout --theirs src/eai.config/types.ts
Package Dependencies
# Accept both and resolve manually
git checkout --theirs package.json
npm install
Environment Variables
# Compare with example
diff .env.local .env.example
# Add any new required variables
Rollback Procedure
If migration fails:
# 1. Restore from backup branch
git checkout backup/pre-migration
# 2. Or revert specific commits
git revert HEAD~3..HEAD
# 3. Clear any corrupted state
rm -rf node_modules
rm -rf .next
npm install
# 4. Restart development
npm run dev
Testing After Migration
Automated Tests
# Run all tests
npm test
# Run specific test suites
npm run test:unit
npm run test:integration
npm run test:e2e
Manual Verification Checklist
- Application starts without errors
- All tenant configs load correctly
- Authentication flow works
- API calls succeed
- Store persistence works
- All pages render correctly
- No console errors in browser
Getting Help
If you encounter issues during migration:
- Check Troubleshooting for common issues
- Review Architecture Decision Records for context
- Open an issue on GitHub
Related Documentation
- Troubleshooting - Common issues
- Configuration Overview - Config system
- CHANGELOG - Version history