first com2
This commit is contained in:
48
alembic/versions/3582c3285f91_ticket_state_ticket_status.py
Normal file
48
alembic/versions/3582c3285f91_ticket_state_ticket_status.py
Normal file
@@ -0,0 +1,48 @@
|
||||
"""ticket.state -> ticket.status.
|
||||
|
||||
Revision ID: 3582c3285f91
|
||||
Revises: 53992c092918
|
||||
Create Date: 2026-04-06 19:02:31.266750
|
||||
|
||||
"""
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "3582c3285f91"
|
||||
down_revision: Union[str, Sequence[str], None] = "53992c092918"
|
||||
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.add_column(
|
||||
"tickets",
|
||||
sa.Column(
|
||||
"status", sa.Enum("OPEN", "CLOSED", name="ticketstatus"), nullable=False
|
||||
),
|
||||
)
|
||||
op.drop_column("tickets", "state")
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column(
|
||||
"tickets",
|
||||
sa.Column(
|
||||
"state",
|
||||
postgresql.ENUM("OPEN", "CLOSED", name="ticketstatus"),
|
||||
autoincrement=False,
|
||||
nullable=False,
|
||||
),
|
||||
)
|
||||
op.drop_column("tickets", "status")
|
||||
# ### end Alembic commands ###
|
||||
36
alembic/versions/53992c092918_ticket_new_field_thread_id.py
Normal file
36
alembic/versions/53992c092918_ticket_new_field_thread_id.py
Normal file
@@ -0,0 +1,36 @@
|
||||
"""ticket new field -> thread_id.
|
||||
|
||||
Revision ID: 53992c092918
|
||||
Revises: fad6b6da6569
|
||||
Create Date: 2026-04-06 18:59:22.573283
|
||||
|
||||
"""
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "53992c092918"
|
||||
down_revision: Union[str, Sequence[str], None] = "fad6b6da6569"
|
||||
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.add_column("tickets", sa.Column("thread_id", sa.BIGINT(), nullable=False))
|
||||
op.create_unique_constraint(None, "tickets", ["thread_id"])
|
||||
op.create_unique_constraint(None, "tickets", ["id"])
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint(None, "tickets", type_="unique")
|
||||
op.drop_constraint(None, "tickets", type_="unique")
|
||||
op.drop_column("tickets", "thread_id")
|
||||
# ### end Alembic commands ###
|
||||
32
alembic/versions/756210f564a5_ticket_thread_id_nullable.py
Normal file
32
alembic/versions/756210f564a5_ticket_thread_id_nullable.py
Normal file
@@ -0,0 +1,32 @@
|
||||
"""ticket.thread_id -> nullable.
|
||||
|
||||
Revision ID: 756210f564a5
|
||||
Revises: d872dba3da66
|
||||
Create Date: 2026-04-06 21:43:17.136851
|
||||
|
||||
"""
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "756210f564a5"
|
||||
down_revision: Union[str, Sequence[str], None] = "d872dba3da66"
|
||||
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.alter_column("tickets", "thread_id", existing_type=sa.BIGINT(), nullable=True)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column("tickets", "thread_id", existing_type=sa.BIGINT(), nullable=False)
|
||||
# ### end Alembic commands ###
|
||||
27
alembic/versions/b833fa0e6dd9_ticket_status_pending.py
Normal file
27
alembic/versions/b833fa0e6dd9_ticket_status_pending.py
Normal file
@@ -0,0 +1,27 @@
|
||||
"""ticket.status - +PENDING
|
||||
|
||||
Revision ID: b833fa0e6dd9
|
||||
Revises: 3582c3285f91
|
||||
Create Date: 2026-04-06 20:16:24.211939
|
||||
|
||||
"""
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "b833fa0e6dd9"
|
||||
down_revision: Union[str, Sequence[str], None] = "3582c3285f91"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
"""Upgrade schema."""
|
||||
op.execute("ALTER TYPE ticketstatus ADD VALUE 'PENDING'")
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
pass
|
||||
@@ -0,0 +1,29 @@
|
||||
"""ticket.status default -> PENDING.
|
||||
|
||||
Revision ID: d872dba3da66
|
||||
Revises: b833fa0e6dd9
|
||||
Create Date: 2026-04-06 20:20:00.618718
|
||||
|
||||
"""
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "d872dba3da66"
|
||||
down_revision: Union[str, Sequence[str], None] = "b833fa0e6dd9"
|
||||
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! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
53
alembic/versions/fad6b6da6569_ticket_table_created.py
Normal file
53
alembic/versions/fad6b6da6569_ticket_table_created.py
Normal file
@@ -0,0 +1,53 @@
|
||||
"""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 ###
|
||||
Reference in New Issue
Block a user