5 Commits

Author SHA1 Message Date
freemo 399939a6db refactor(db): migrate from create_all() to Alembic-managed schema migrations
Complete the Alembic migration infrastructure by adding CLI commands,
improving stamp logic, and adding comprehensive lifecycle tests.

Key changes:
- Added agents db CLI command group (db.py) with 5 subcommands:
  migrate (autogenerate), upgrade, downgrade, current, history.
  All delegate to MigrationRunner which wraps Alembic command API.
- Registered the db command group in main.py CLI registration.
- Fixed legacy database stamp logic in MigrationRunner to stamp at
  "head" instead of "001_initial_schema" when pre-Alembic tables are
  detected. This avoids migration failures when create_all-produced
  tables already exist (migrations would try to CREATE TABLE and fail
  with "table already exists").
- Added commit() after stamp to ensure alembic_version is persisted
  before subsequent operations on the same in-memory database.
- Added FakeConnection.commit() method to the mock test infrastructure
  to support the new commit call in the stamp path.
- Added Behave feature (db_migration_lifecycle.feature) with 8
  scenarios covering: forward migration, rollback, round-trip,
  CLI upgrade/current/downgrade, legacy stamp logic, and
  init_database schema validation.
- Added vulture whitelist entries for new CLI commands.

Note: init_database() still uses Base.metadata.create_all() as the
primary schema creation path. Full migration to Alembic-only init is
deferred until ORM model constraints are reconciled with migration
scripts (action_arguments UniqueConstraint mismatch).

ISSUES CLOSED: #941
2026-03-18 17:16:32 +00:00
freemo 7430b6e743 Feat: Added basic scaffolding for actors 2025-12-23 17:12:16 -05:00
freemo 34a29d7cc8 Feat: Adding Actors support to database 2025-12-19 12:35:56 -05:00
freemo 496f565a57 Chore: Completed stage 1.5 2025-11-24 20:04:18 -05:00
freemo af5093c881 Chore: Got code coverage up to 98% 2025-11-19 22:40:53 -05:00