Database Migration Guide
[!NOTE] 最新の実装状況は 機能実装ステータス (Remaining Functionality) を参照してください。
This document explains how to run Alembic migrations for EvoSpikeNet.
Prerequisites
- alembic is installed (see requirements.txt).
- DATABASE_URL environment variable points to your database (Postgres recommended).
- Backup your database before applying migrations.
Quick start
# install dependencies into your virtualenv
pip install -r requirements.txt
# Ensure DATABASE_URL is set, e.g.:
export DATABASE_URL=postgresql://user:pass@db-host:5432/evospikenet
# Initialize alembic (if not already initialized)
# alembic init alembic
# Generate revision (only if you modify models)
# alembic revision --autogenerate -m "describe change"
# Apply migrations
alembic upgrade head
Notes
- The repository includes a migration adding the encrypted column to data_artifacts at alembic/versions/20260304_add_dataartifact_encrypted_column.py.
- If you maintain a production DB, test the migration on a staging copy first.
- If your project uses a different DB URL for migrations, set sqlalchemy.url in alembic.ini or rely on DATABASE_URL environment variable.
Rollback
# show history
alembic history --verbose
# downgrade to previous revision
alembic downgrade -1
If you want help generating a full migration plan or automating this in CI, I can add GitHub Actions steps.