Skip to content

Commit

Permalink
update Products table - include sale_price field
Browse files Browse the repository at this point in the history
  • Loading branch information
jll38 committed May 7, 2024
1 parent bebb349 commit 614bca4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""add sale_price to product table
Revision ID: 8f76f37078c0
Revises: 73a533f1f156
Create Date: 2024-05-07 18:43:35.647485
"""
from typing import Sequence, Union

from alembic import op
from sqlalchemy import Float
import sqlalchemy as sa

# revision identifiers, used by Alembic.
revision: str = '8f76f37078c0'
down_revision: Union[str, None] = '73a533f1f156'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
op.add_column('products', sa.Column('sale_price', Float, nullable=True))


def downgrade() -> None:
op.drop_column('products', 'sale_price')
1 change: 1 addition & 0 deletions backend/app/models/sqlalchemy/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Product(Base):
product_type = Column(String, index=True)
product_name = Column(String)
price = Column(Float, nullable=False)
sale_price = Column(Float, nullable=True)
blurb = Column(Text, nullable=True)
description = Column(Text, nullable=True)
image_url = Column(String, nullable=True)
Expand Down

0 comments on commit 614bca4

Please sign in to comment.