PamGram/alembic/versions/27aaa52f9d4a_groups.py
2024-01-16 23:06:03 +08:00

58 lines
1.8 KiB
Python

"""groups
Revision ID: 27aaa52f9d4a
Revises: c6282bc5bf67
Create Date: 2024-01-16 13:54:37.980830
"""
from alembic import op
import sqlalchemy as sa
import sqlmodel
# revision identifiers, used by Alembic.
revision = "27aaa52f9d4a"
down_revision = "c6282bc5bf67"
branch_labels = None
depends_on = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"groups",
sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
sa.Column("chat_id", sa.BigInteger(), nullable=True),
sa.Column(
"type",
sa.Enum(
"SENDER",
"PRIVATE",
"GROUP",
"SUPERGROUP",
"CHANNEL",
name="chattypeenum",
),
nullable=True,
),
sa.Column("description", sa.TEXT(), nullable=True),
sa.Column("created_at", sa.DateTime(timezone=True), nullable=True),
sa.Column("updated_at", sa.DateTime(timezone=True), nullable=True),
sa.Column("is_left", sa.Integer(), nullable=True),
sa.Column("is_banned", sa.Integer(), nullable=True),
sa.Column("title", sqlmodel.AutoString(), nullable=False),
sa.Column("username", sqlmodel.AutoString(), nullable=True),
sa.Column("big_photo_id", sqlmodel.AutoString(), nullable=True),
sa.Column("small_photo_id", sqlmodel.AutoString(), nullable=True),
sa.PrimaryKeyConstraint("id"),
sa.UniqueConstraint("chat_id"),
mysql_charset="utf8mb4",
mysql_collate="utf8mb4_general_ci",
)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table("groups")
# ### end Alembic commands ###