diff --git a/app/api/alembic/sanctuary/versions/2024-03-22_5a6e3d13358f_document_num_and_comment.py b/app/api/alembic/sanctuary/versions/2024-03-22_5a6e3d13358f_document_num_and_comment.py new file mode 100644 index 0000000..d788441 --- /dev/null +++ b/app/api/alembic/sanctuary/versions/2024-03-22_5a6e3d13358f_document_num_and_comment.py @@ -0,0 +1,55 @@ +"""CHANGEME + +Revision ID: 5a6e3d13358f +Revises: 38ecd95d6104 +Create Date: 2024-03-22 18:05:23.388169 + +""" +from alembic import op +import sqlalchemy as sa + +from alembic import context + +# revision identifiers, used by Alembic. +revision = '5a6e3d13358f' +down_revision = '38ecd95d6104' +branch_labels = None +depends_on = None + + +def upgrade(): + schema_upgrades() + if context.get_x_argument(as_dictionary=True).get("data", None): + data_upgrades() + + +def downgrade(): + if context.get_x_argument(as_dictionary=True).get("data", None): + data_downgrades() + schema_downgrades() + + +def schema_upgrades(): + """schema upgrade migrations go here.""" + # ### commands auto generated by Alembic - please adjust! ### + op.add_column('intakes', sa.Column('document_num', sa.String(), nullable=True)) + op.add_column('intakes', sa.Column('comment', sa.String(), nullable=True)) + # ### end Alembic commands ### + + +def schema_downgrades(): + """schema downgrade migrations go here.""" + # ### commands auto generated by Alembic - please adjust! ### + op.drop_column('intakes', 'comment') + op.drop_column('intakes', 'document_num') + # ### end Alembic commands ### + + +def data_upgrades(): + """Add any optional data upgrade migrations here!""" + pass + + +def data_downgrades(): + """Add any optional data downgrade migrations here!""" + pass \ No newline at end of file diff --git a/app/api/models/intake.py b/app/api/models/intake.py index a8f83c7..166cdbc 100644 --- a/app/api/models/intake.py +++ b/app/api/models/intake.py @@ -32,6 +32,8 @@ class Intake(BaseSanctuary, BasicMetrics): discharge_date = Column(DateTime, nullable=True) discharge_time = Column(DateTime, nullable=True) discharge_method = Column(String, nullable=True) + document_num = Column(String, nullable=True) + comment = Column(String, nullable=True) def get_intake_by_uuid( db: Session, uuid: uuid.UUID diff --git a/app/api/schemas/intake.py b/app/api/schemas/intake.py index a926bcb..f5142d1 100644 --- a/app/api/schemas/intake.py +++ b/app/api/schemas/intake.py @@ -9,6 +9,7 @@ class IntakeSchema(BaseModel): An intake for a given patient. """ + document_num: Optional[str] guest_rfid: Optional[str] arrival_date: datetime arrival_time: datetime @@ -23,6 +24,7 @@ class IntakeSchema(BaseModel): discharge_date: datetime discharge_time: datetime discharge_method: Optional[str] + comment: Optional[str] class Config: orm_mode = True