"""change_lab_result_date_fields_to_date_and_make_ordered_date_nullable

Revision ID: cafafc906cf3
Revises: d87e96e7e961
Create Date: 2025-06-28 15:52:36.630969

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = 'cafafc906cf3'
down_revision = 'd87e96e7e961'
branch_labels = None
depends_on = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('lab_results', 'ordered_date',
               existing_type=postgresql.TIMESTAMP(),
               type_=sa.Date(),
               nullable=True)
    op.alter_column('lab_results', 'completed_date',
               existing_type=postgresql.TIMESTAMP(),
               type_=sa.Date(),
               existing_nullable=True)
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('lab_results', 'completed_date',
               existing_type=sa.Date(),
               type_=postgresql.TIMESTAMP(),
               existing_nullable=True)
    op.alter_column('lab_results', 'ordered_date',
               existing_type=sa.Date(),
               type_=postgresql.TIMESTAMP(),
               nullable=False)
    # ### end Alembic commands ###
