-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: fix OutOfRangeError Some product quantity triggered an OutOfRangeError in PostgreSQL We now set the quantity to None if it's above a threshold * fix: set unique_scans_n default to 0
- Loading branch information
1 parent
dca9098
commit 57e4adb
Showing
4 changed files
with
60 additions
and
8 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
alembic/versions/20240109_1330_1bf4306fff2f_set_unique_scans_n_default_to_0.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
"""set unique_scans_n default to 0 | ||
Revision ID: 1bf4306fff2f | ||
Revises: 3f8d293e669e | ||
Create Date: 2024-01-09 13:30:47.327891 | ||
""" | ||
from typing import Sequence, Union | ||
|
||
import sqlalchemy as sa | ||
|
||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = "1bf4306fff2f" | ||
down_revision: Union[str, None] = "3f8d293e669e" | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.execute("UPDATE products SET unique_scans_n = 0 WHERE unique_scans_n IS NULL;") | ||
op.alter_column( | ||
"products", | ||
"unique_scans_n", | ||
existing_type=sa.INTEGER(), | ||
nullable=False, | ||
server_default="0", | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.alter_column( | ||
"products", | ||
"unique_scans_n", | ||
existing_type=sa.INTEGER(), | ||
nullable=True, | ||
server_default=None, | ||
) | ||
# ### end Alembic commands ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters