Добавлен заказ накладной
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
"""Rework orders table to a single payload JSONB column."""
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
|
||||
revision: str = "20260513_032"
|
||||
down_revision: str | None = "20260412_028"
|
||||
branch_labels: str | Sequence[str] | None = None
|
||||
depends_on: str | Sequence[str] | None = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.drop_column("orders", "sender")
|
||||
op.drop_column("orders", "recipient")
|
||||
op.drop_column("orders", "from_location")
|
||||
op.drop_column("orders", "to_location")
|
||||
op.drop_column("orders", "packages")
|
||||
op.drop_column("orders", "services")
|
||||
op.drop_column("orders", "comment")
|
||||
op.drop_column("orders", "delivery_type")
|
||||
op.add_column(
|
||||
"orders",
|
||||
sa.Column(
|
||||
"payload",
|
||||
postgresql.JSONB(astext_type=sa.Text()),
|
||||
nullable=False,
|
||||
),
|
||||
)
|
||||
op.add_column(
|
||||
"orders",
|
||||
sa.Column("account_email", sa.String(length=320), nullable=False),
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_column("orders", "account_email")
|
||||
op.drop_column("orders", "payload")
|
||||
op.add_column(
|
||||
"orders",
|
||||
sa.Column("delivery_type", sa.Integer(), nullable=False),
|
||||
)
|
||||
op.add_column(
|
||||
"orders",
|
||||
sa.Column("comment", sa.String(length=1024), nullable=True),
|
||||
)
|
||||
op.add_column(
|
||||
"orders",
|
||||
sa.Column(
|
||||
"services",
|
||||
postgresql.JSONB(astext_type=sa.Text()),
|
||||
nullable=True,
|
||||
),
|
||||
)
|
||||
op.add_column(
|
||||
"orders",
|
||||
sa.Column(
|
||||
"packages",
|
||||
postgresql.JSONB(astext_type=sa.Text()),
|
||||
nullable=False,
|
||||
),
|
||||
)
|
||||
op.add_column(
|
||||
"orders",
|
||||
sa.Column(
|
||||
"to_location",
|
||||
postgresql.JSONB(astext_type=sa.Text()),
|
||||
nullable=False,
|
||||
),
|
||||
)
|
||||
op.add_column(
|
||||
"orders",
|
||||
sa.Column(
|
||||
"from_location",
|
||||
postgresql.JSONB(astext_type=sa.Text()),
|
||||
nullable=False,
|
||||
),
|
||||
)
|
||||
op.add_column(
|
||||
"orders",
|
||||
sa.Column(
|
||||
"recipient",
|
||||
postgresql.JSONB(astext_type=sa.Text()),
|
||||
nullable=False,
|
||||
),
|
||||
)
|
||||
op.add_column(
|
||||
"orders",
|
||||
sa.Column(
|
||||
"sender",
|
||||
postgresql.JSONB(astext_type=sa.Text()),
|
||||
nullable=False,
|
||||
),
|
||||
)
|
||||
@@ -0,0 +1,28 @@
|
||||
"""Add CDEK waybill columns to orders table."""
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision: str = "20260523_033"
|
||||
down_revision: str | None = "20260513_032"
|
||||
branch_labels: str | Sequence[str] | None = None
|
||||
depends_on: str | Sequence[str] | None = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.add_column(
|
||||
"orders",
|
||||
sa.Column("cdek_waybill_uuid", sa.String(length=128), nullable=True),
|
||||
)
|
||||
op.add_column(
|
||||
"orders",
|
||||
sa.Column("cdek_waybill_url", sa.String(length=2048), nullable=True),
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_column("orders", "cdek_waybill_url")
|
||||
op.drop_column("orders", "cdek_waybill_uuid")
|
||||
Reference in New Issue
Block a user