Migration Guide
This guide covers common migration scenarios for Memori users. Whether you are upgrading between versions, migrating your database, or transitioning from the hosted platform to self-hosted, this page will help you through the process.
Want a zero-setup option? The hosted platform at app.memorilabs.ai offers 100 memories free without an API key, and 5,000/month with a free API key.
Upgrading Memori
When a new version of Memori is released, upgrading is straightforward in most cases. Run pip to install the latest version:
pip install --upgrade memori
After upgrading, check the Changelog for any breaking changes or new features that may require code adjustments.
Database Schema Changes
Memori uses SQLAlchemy for database management. When you call mem.config.storage.build(), the required database tables are created automatically if they do not already exist.
If a new version introduces schema changes (new tables or columns), the build() method will handle creating any new structures. However, there are some scenarios where manual intervention may be needed:
Adding New Columns
If a new version adds columns to existing tables, SQLAlchemy's create_all() (used by build()) will create new tables but will not alter existing ones. In these cases:
- Check the release notes to see if manual migration steps are listed
- Use Alembic or a similar migration tool if provided
- As a last resort, you can back up your data and recreate the database
from memori import Memori
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
engine = create_engine("sqlite:///memori.db")
SessionLocal = sessionmaker(bind=engine)
mem = Memori(conn=SessionLocal)
# This creates any missing tables
mem.config.storage.build()
Getting Help
If you run into issues during migration:
- Check the FAQ for common questions
- Visit the Troubleshooting guide
- Open an issue on GitHub for bugs or feature requests
- Review the latest changes in the Changelog