Skip to content

Commit

Permalink
Added inventory_id column for schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
justintroy committed Jan 7, 2024
1 parent 80ed8ad commit 9db1171
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""Added inventory_id column for schedule
Revision ID: 4fc231816655
Revises: d945da89599c
Create Date: 2024-01-07 11:27:52.029590
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '4fc231816655'
down_revision = 'd945da89599c'
branch_labels = None
depends_on = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('schedule', sa.Column('inventory_id', sa.String(), nullable=True))
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('schedule', 'inventory_id')
# ### end Alembic commands ###
1 change: 1 addition & 0 deletions app/api/schedule/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def upsert_user_schedules(db: Session, user_id: str, schedules: list[Schedule]):
set_={
"updated_at": datetime.utcnow(),
"time_to_take": stmt.excluded.time_to_take,
"inventory_id": stmt.excluded.inventory_id,
"schedule_state": stmt.excluded.schedule_state,
"notes": stmt.excluded.notes,
"quantity": stmt.excluded.quantity,
Expand Down
1 change: 1 addition & 0 deletions app/api/schedule/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

class Schedule(BaseModel):
schedule_id: Optional[str]
inventory_id: Optional[str]
created_at: Optional[datetime]
updated_at: Optional[datetime]
deleted_at: Optional[datetime]
Expand Down
1 change: 1 addition & 0 deletions app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class Schedule(Base):
__tablename__ = "schedule"

schedule_id = Column(String, unique=True, nullable=False)
inventory_id = Column(String, nullable=True)
user_id = Column(UUID, primary_key=True, nullable=False)
created_at = Column(DateTime, nullable=True)
updated_at = Column(DateTime, nullable=True)
Expand Down

0 comments on commit 9db1171

Please sign in to comment.