"""create_family_history_tables

Revision ID: e409e0efe1d4
Revises: ba57e3612c92
Create Date: 2025-07-12 21:31:01.517396

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'e409e0efe1d4'
down_revision = 'ba57e3612c92'
branch_labels = None
depends_on = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('family_members',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('patient_id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(), nullable=False),
    sa.Column('relationship', sa.String(), nullable=False),
    sa.Column('gender', sa.String(), nullable=True),
    sa.Column('birth_year', sa.Integer(), nullable=True),
    sa.Column('death_year', sa.Integer(), nullable=True),
    sa.Column('is_deceased', sa.Boolean(), nullable=False),
    sa.Column('notes', sa.Text(), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=False),
    sa.Column('updated_at', sa.DateTime(), nullable=False),
    sa.ForeignKeyConstraint(['patient_id'], ['patients.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('family_conditions',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('family_member_id', sa.Integer(), nullable=False),
    sa.Column('condition_name', sa.String(), nullable=False),
    sa.Column('diagnosis_age', sa.Integer(), nullable=True),
    sa.Column('severity', sa.String(), nullable=True),
    sa.Column('status', sa.String(), nullable=True),
    sa.Column('condition_type', sa.String(), nullable=True),
    sa.Column('notes', sa.Text(), nullable=True),
    sa.Column('icd10_code', sa.String(), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=False),
    sa.Column('updated_at', sa.DateTime(), nullable=False),
    sa.ForeignKeyConstraint(['family_member_id'], ['family_members.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('family_conditions')
    op.drop_table('family_members')
    # ### end Alembic commands ###
