Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion migrations/versions/1555220764ee_.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from alembic import op
import sqlalchemy as sa

from utils.utils import get_bot_photo_id

# revision identifiers, used by Alembic.
revision: str = '1555220764ee'
Expand All @@ -21,6 +20,7 @@

def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
from utils.utils import get_bot_photo_id
op.execute("PRAGMA foreign_keys=0;")
bot_photo_id = f"0{get_bot_photo_id()}"
op.add_column('categories', sa.Column('media_id', sa.String(), nullable=True))
Expand Down
33 changes: 33 additions & 0 deletions migrations/versions/91c3856a8aa0_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""empty message

Revision ID: 91c3856a8aa0
Revises: 43803f266c4a
Create Date: 2026-02-04 16:22:11.047432

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = '91c3856a8aa0'
down_revision: Union[str, None] = '43803f266c4a'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
op.alter_column(
"deposits",
"amount",
existing_type=sa.BigInteger(),
type_=sa.Numeric(precision=78, scale=0),
postgresql_using="amount::numeric",
existing_nullable=False,
)


def downgrade() -> None:
pass
4 changes: 2 additions & 2 deletions migrations/versions/d14008036574_.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
import sqlalchemy as sa
from sqlalchemy import table, column

from enums.buy_status import BuyStatus
from enums.item_type import ItemType

# revision identifiers, used by Alembic.
revision: str = 'd14008036574'
Expand All @@ -22,6 +20,8 @@


def upgrade() -> None:
from enums.buy_status import BuyStatus
from enums.item_type import ItemType
op.execute("PRAGMA foreign_keys=0;")

item_type_enum = sa.Enum(ItemType)
Expand Down
4 changes: 2 additions & 2 deletions models/deposit.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from pydantic import BaseModel
from sqladmin import ModelView
from sqlalchemy import Integer, Column, ForeignKey, BigInteger, DateTime, func, CheckConstraint, Enum, Float
from sqlalchemy import Integer, Column, ForeignKey, DateTime, func, CheckConstraint, Enum, Float, Numeric
from sqlalchemy.orm import relationship

import config
Expand All @@ -19,7 +19,7 @@ class Deposit(Base):
user_id = Column(Integer, ForeignKey('users.id'), nullable=False)
user = relationship("User", back_populates="deposits")
network = Column(Enum(Cryptocurrency), nullable=False)
amount = Column(BigInteger, nullable=False)
amount = Column(Numeric(precision=78, scale=0), nullable=False)
deposit_datetime = Column(DateTime(timezone=True), default=func.now())
fiat_amount = Column(Float, nullable=False)

Expand Down
Loading