"""Add DNS verification fields to portfolio_domains

Revision ID: 006
Revises: 005
Create Date: 2025-12-13
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '006'
down_revision = '005'
branch_labels = None
depends_on = None


def upgrade() -> None:
    """Add DNS verification columns to portfolio_domains table."""
    # Add columns with default values (nullable to avoid issues with existing rows)
    op.add_column('portfolio_domains', sa.Column('is_dns_verified', sa.Boolean(), nullable=True, server_default='0'))
    op.add_column('portfolio_domains', sa.Column('verification_status', sa.String(50), nullable=True, server_default='unverified'))
    op.add_column('portfolio_domains', sa.Column('verification_code', sa.String(100), nullable=True))
    op.add_column('portfolio_domains', sa.Column('verification_started_at', sa.DateTime(), nullable=True))
    op.add_column('portfolio_domains', sa.Column('verified_at', sa.DateTime(), nullable=True))


def downgrade() -> None:
    """Remove DNS verification columns from portfolio_domains table."""
    op.drop_column('portfolio_domains', 'verified_at')
    op.drop_column('portfolio_domains', 'verification_started_at')
    op.drop_column('portfolio_domains', 'verification_code')
    op.drop_column('portfolio_domains', 'verification_status')
    op.drop_column('portfolio_domains', 'is_dns_verified')
