"""Add article validity fields.

Revision ID: 0011_add_article_validity_fields
Revises: 0010_add_rag_export_state
Create Date: 2026-05-07
"""
from alembic import op
import sqlalchemy as sa


revision = "0011_add_article_validity_fields"
down_revision = "0010_add_rag_export_state"
branch_labels = None
depends_on = None


def upgrade() -> None:
    op.add_column("article", sa.Column("is_effective", sa.Boolean()))
    op.add_column("article", sa.Column("expiry_date", sa.Date()))
    op.create_index("ix_article_is_effective", "article", ["is_effective"])
    op.create_index("ix_article_expiry_date", "article", ["expiry_date"])


def downgrade() -> None:
    op.drop_index("ix_article_expiry_date", table_name="article")
    op.drop_index("ix_article_is_effective", table_name="article")
    op.drop_column("article", "expiry_date")
    op.drop_column("article", "is_effective")
