54 lines
1.6 KiB
Python
54 lines
1.6 KiB
Python
"""ticket table created.
|
|
|
|
Revision ID: fad6b6da6569
|
|
Revises: c447fdf8cc97
|
|
Create Date: 2026-04-06 18:52:07.980432
|
|
|
|
"""
|
|
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = "fad6b6da6569"
|
|
down_revision: Union[str, Sequence[str], None] = "c447fdf8cc97"
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
"""Upgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table(
|
|
"tickets",
|
|
sa.Column("id", sa.INTEGER(), autoincrement=True, nullable=False),
|
|
sa.Column("creator_id", sa.BIGINT(), nullable=False),
|
|
sa.Column(
|
|
"state", sa.Enum("OPEN", "CLOSED", name="ticketstatus"), nullable=False
|
|
),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
sa.UniqueConstraint("id"),
|
|
)
|
|
op.drop_constraint(op.f("users_support_thread_id_key"), "users", type_="unique")
|
|
op.drop_column("users", "support_thread_id")
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
"""Downgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.add_column(
|
|
"users",
|
|
sa.Column("support_thread_id", sa.BIGINT(), autoincrement=False, nullable=True),
|
|
)
|
|
op.create_unique_constraint(
|
|
op.f("users_support_thread_id_key"),
|
|
"users",
|
|
["support_thread_id"],
|
|
postgresql_nulls_not_distinct=False,
|
|
)
|
|
op.drop_table("tickets")
|
|
# ### end Alembic commands ###
|