Add message_id and chat_id to CachedFile

This commit is contained in:
2022-12-30 23:01:21 +01:00
parent 53623592ec
commit 339ae64363
2 changed files with 32 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
"""empty message
Revision ID: f77b0b14f9eb
Revises: 9b7cfb422191
Create Date: 2022-12-30 22:53:41.951490
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "f77b0b14f9eb"
down_revision = "9b7cfb422191"
branch_labels = None
depends_on = None
def upgrade():
op.add_column(
"cached_files", sa.Column("message_id", sa.BigInteger(), nullable=True)
)
op.add_column("cached_files", sa.Column("chat_id", sa.BigInteger(), nullable=True))
def downgrade():
op.drop_column("cached_files", "message_id")
op.drop_column("cached_files", "chat_id")

View File

@@ -16,4 +16,8 @@ class CachedFile(ormar.Model):
id: int = ormar.Integer(primary_key=True) # type: ignore
object_id: int = ormar.Integer(index=True) # type: ignore
object_type: str = ormar.String(max_length=8, index=True) # type: ignore
message_id: int = ormar.BigInteger() # type: ignore
chat_id: int = ormar.BigInteger() # type: ignore
data: dict = ormar.JSON() # type: ignore