generated from coulomb/repo-seed
feat(db): ORM models + Alembic migrations 0001–0003 — T09/T10/T11
SQLAlchemy ORM (src/activity_core/orm.py):
- ActivityDefinition, ActivityRun, TaskInstance mapped to Base.metadata
- Wired into migrations/env.py for autogenerate support
Migrations (chained 0001 → 0002 → 0003):
- 0001: activity_definitions (id, name, enabled, trigger_type,
trigger_config JSONB, context_sources JSONB, task_templates JSONB,
dedupe_key_strategy, version, created_at, updated_at)
- 0002: activity_runs (run_id, activity_id FK→activity_definitions,
scheduled_for, fired_at, context_snapshot JSONB, tasks_spawned,
version_used) + index on activity_id
- 0003: task_instances (id, run_id FK→activity_runs CASCADE,
type, params JSONB, status, created_at) + index on run_id
Apply with: ACTCORE_DB_URL=... alembic upgrade head
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -8,7 +8,8 @@ from sqlalchemy.ext.asyncio import async_engine_from_config
|
||||
|
||||
from alembic import context
|
||||
|
||||
from activity_core.db import Base # noqa: F401 — imports all ORM models via submodules
|
||||
from activity_core.db import Base # noqa: F401
|
||||
import activity_core.orm # noqa: F401 — registers all ORM tables into Base.metadata
|
||||
|
||||
# Alembic Config object — access to values in alembic.ini
|
||||
config = context.config
|
||||
|
||||
Reference in New Issue
Block a user