46 lines
1.2 KiB
Python
46 lines
1.2 KiB
Python
"""Add retention and redaction state to scoring_runs and review_audits.
|
|
|
|
Revision ID: 0008_retention_redaction_state
|
|
Revises: 0007_outbox_delivery_state
|
|
Create Date: 2026-08-28
|
|
|
|
"""
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
revision: str = "0008_retention_redaction_state"
|
|
down_revision: str | None = "0007_outbox_delivery_state"
|
|
branch_labels: str | None = None
|
|
depends_on: str | None = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.add_column(
|
|
"scoring_runs",
|
|
sa.Column("redacted_at", sa.DateTime(timezone=True), nullable=True),
|
|
)
|
|
op.create_index(
|
|
"ix_scoring_runs_retention",
|
|
"scoring_runs",
|
|
["created_at", "redacted_at"],
|
|
)
|
|
|
|
op.add_column(
|
|
"review_audits",
|
|
sa.Column("redacted_at", sa.DateTime(timezone=True), nullable=True),
|
|
)
|
|
op.create_index(
|
|
"ix_review_audits_retention",
|
|
"review_audits",
|
|
["created_at", "redacted_at"],
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_index("ix_review_audits_retention", table_name="review_audits")
|
|
op.drop_column("review_audits", "redacted_at")
|
|
|
|
op.drop_index("ix_scoring_runs_retention", table_name="scoring_runs")
|
|
op.drop_column("scoring_runs", "redacted_at")
|