# Database Migrations FusionAGI uses a lightweight migration system for schema changes. ## Structure ``` migrations/ ├── README.md ├── versions/ │ └── 001_initial_schema.sql └── migrate.py ``` ## Usage ```bash # Run all pending migrations python -m migrations.migrate up # Rollback the last migration python -m migrations.migrate down # Show migration status python -m migrations.migrate status ``` ## Creating a Migration 1. Create a new SQL file in `migrations/versions/`: ``` NNN_description.sql ``` 2. Include both `-- UP` and `-- DOWN` sections: ```sql -- UP CREATE TABLE example (...); -- DOWN DROP TABLE IF EXISTS example; ``` ## Notes - Migrations run in numeric order (001, 002, etc.) - Each migration is tracked in a `_migrations` table - For production, consider using Alembic with SQLAlchemy