AccuPedia Alembic bootstrap
============================
Files:
env.py
versions/20260924_0001_baseline_existing_schema.py
versions/20260924_0002_add_template_search_flags.py
Expected project placement:
<repo-root>/
├── alembic.ini
├── alembic/
│ ├── env.py
│ ├── script.py.mako
│ └── versions/
│ ├── 20260924_0001_baseline_existing_schema.py
│ └── 20260924_0002_add_template_search_flags.py
└── app/
Initialization sequence:
1. From repo root:
alembic init alembic
2. Replace generated alembic/env.py with this env.py.
3. Copy both revision files into alembic/versions/.
4. Ensure alembic.ini keeps a sqlalchemy.url key.
Its literal value is not used as the authoritative source because env.py
overwrites it from app.core.config.settings.database_url.
5. Existing database only:
alembic stamp 20260924_0001
6. Apply new schema change:
alembic upgrade head
7. Verify:
alembic current
alembic heads
Important:
- Do NOT run `alembic stamp head` before applying 20260924_0002. That would mark
the search-flag migration as applied without actually adding the columns.
- For a brand-new empty database, this two-file baseline approach does not
create the historical schema. Continue using your existing schema bootstrap
until the complete historical schema is migrated into Alembic, or create a
dedicated initial-schema migration later.