add drug dosages parsing, add postgres db

This commit is contained in:
ipu 2025-08-07 01:04:44 +03:00
parent c218e0bbf3
commit 4a59ba5f4a
15 changed files with 856 additions and 122 deletions

View file

@ -0,0 +1,48 @@
"""add drug table
Revision ID: c509dcf806d4
Revises:
Create Date: 2025-08-06 19:33:52.814812
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = 'c509dcf806d4'
down_revision: Union[str, Sequence[str], None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
"""Upgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('drugs',
sa.Column('id', sa.BigInteger(), nullable=False),
sa.Column('name', sa.String(), nullable=False),
sa.Column('dosage', sa.Float(), nullable=False),
sa.Column('dosage_unit', sa.String(), nullable=False),
sa.Column('unit_price', sa.Float(), nullable=False),
sa.Column('description', sa.Text(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
with op.batch_alter_table('drugs', schema=None) as batch_op:
batch_op.create_index(batch_op.f('ix_drugs_id'), ['id'], unique=False)
batch_op.create_index(batch_op.f('ix_drugs_name'), ['name'], unique=False)
# ### end Alembic commands ###
def downgrade() -> None:
"""Downgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('drugs', schema=None) as batch_op:
batch_op.drop_index(batch_op.f('ix_drugs_name'))
batch_op.drop_index(batch_op.f('ix_drugs_id'))
op.drop_table('drugs')
# ### end Alembic commands ###