40 lines
1.2 KiB
Python
40 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")
|