Derive frontmatter and task-block depends_on edges from the pinned commit and reconcile workplan_dependencies under an explicit ownership contract: only forge:<repo> rows are created or removed, external relations are preserved, missing/ambiguous/self targets are recorded and hold owned edges, failures roll back, and repeat receipts are noop. Additive migration b3c4d5e6f7a8. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Assistant: claude-code Assistant-Model: opus Assistant-Process: 671493@bnt-lap001 Assistant-Session: 60d7b11f-78f9-4731-9367-918511b2762d
39 lines
1.2 KiB
Python
39 lines
1.2 KiB
Python
"""workplan dependency source ownership (STATE-WP-0094-T05)
|
|
|
|
Additive: ``workplan_dependencies.source_owner`` marks edges that normal Forge
|
|
receiving derived from a repository's files (``forge:<repo-slug>``) and
|
|
``source_commit`` records the immutable commit that introduced them. Existing
|
|
rows stay NULL, i.e. externally authored, and are never removed by receiving.
|
|
|
|
Revision ID: b3c4d5e6f7a8
|
|
Revises: a0b1c2d3e4f5
|
|
"""
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
revision = "b3c4d5e6f7a8"
|
|
down_revision = "a0b1c2d3e4f5"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.add_column(
|
|
"workplan_dependencies",
|
|
sa.Column("source_owner", sa.String(length=160), nullable=True),
|
|
)
|
|
op.add_column(
|
|
"workplan_dependencies",
|
|
sa.Column("source_commit", sa.String(length=64), nullable=True),
|
|
)
|
|
op.create_index(
|
|
"ix_workplan_dependencies_source_owner",
|
|
"workplan_dependencies",
|
|
["source_owner"],
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_index("ix_workplan_dependencies_source_owner", table_name="workplan_dependencies")
|
|
op.drop_column("workplan_dependencies", "source_commit")
|
|
op.drop_column("workplan_dependencies", "source_owner")
|