Transactional return command with idempotency, row-lock concurrency control, odometer-regression handling, vehicle status derivation, outbox event, audit trail. Result-summary UI on booking detail. 26 backend tests passing, ruff clean. Verified end-to-end via browser against S1 demo scenario; fixed two real defects found only through browser testing (UI state loss on status transition, unflushed UUID default).
42 lines
1.5 KiB
Python
42 lines
1.5 KiB
Python
"""idempotency records
|
|
|
|
Revision ID: e7b08389f47f
|
|
Revises: c9498525abb5
|
|
Create Date: 2026-08-01 21:24:35.472070
|
|
|
|
"""
|
|
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 = 'e7b08389f47f'
|
|
down_revision: Union[str, None] = 'c9498525abb5'
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('idempotency_records',
|
|
sa.Column('idempotency_key', sa.String(length=128), nullable=False),
|
|
sa.Column('booking_id', sa.UUID(), nullable=False),
|
|
sa.Column('response_status', sa.Integer(), nullable=False),
|
|
sa.Column('response_body', postgresql.JSONB(astext_type=sa.Text()), nullable=False),
|
|
sa.Column('id', sa.UUID(), nullable=False),
|
|
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
|
|
sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
|
|
sa.ForeignKeyConstraint(['booking_id'], ['bookings.id'], ),
|
|
sa.PrimaryKeyConstraint('id'),
|
|
sa.UniqueConstraint('idempotency_key')
|
|
)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_table('idempotency_records')
|
|
# ### end Alembic commands ###
|