diff --git a/alembic/versions/20231213_1307_727cb6912bd5_add_prices_product_name_field.py b/alembic/versions/20231213_1307_727cb6912bd5_add_prices_product_name_field.py index d4a9dbe1..2aa966ca 100644 --- a/alembic/versions/20231213_1307_727cb6912bd5_add_prices_product_name_field.py +++ b/alembic/versions/20231213_1307_727cb6912bd5_add_prices_product_name_field.py @@ -21,14 +21,10 @@ def upgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.add_column("prices", sa.Column("product_name", sa.String(), nullable=True)) - op.create_index( - op.f("ix_prices_product_name"), "prices", ["product_name"], unique=False - ) # ### end Alembic commands ### def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### - op.drop_index(op.f("ix_prices_product_name"), table_name="prices") op.drop_column("prices", "product_name") # ### end Alembic commands ### diff --git a/app/models.py b/app/models.py index 61c9703f..8d07b450 100644 --- a/app/models.py +++ b/app/models.py @@ -94,7 +94,7 @@ class Price(Base): id = Column(Integer, primary_key=True, index=True) product_code = Column(String, nullable=True, index=True) - product_name = Column(String, nullable=True, index=True) + product_name = Column(String, nullable=True) category_tag = Column(String, nullable=True, index=True) labels_tags = Column(JSONVariant, nullable=True, index=True) product_id: Mapped[int] = mapped_column(ForeignKey("products.id"), nullable=True) diff --git a/app/schemas.py b/app/schemas.py index 9f18e8de..b26bad84 100644 --- a/app/schemas.py +++ b/app/schemas.py @@ -90,7 +90,7 @@ class PriceCreate(BaseModel): examples=["16584958", "8001505005707"], ) product_name: str | None = Field( - defaul=None, + default=None, min_length=1, description="name of the product, as displayed on the receipt or the price tag.", examples=["PATE NOCCIOLATA BIO 700G"],