43 lines
1.5 KiB
Python
43 lines
1.5 KiB
Python
"""order financials and invoice link
|
|
|
|
Revision ID: 72e78a8a43cf
|
|
Revises: bc424721d767
|
|
Create Date: 2026-08-02 13:55:18.013052
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = '72e78a8a43cf'
|
|
down_revision: Union[str, Sequence[str], None] = 'bc424721d767'
|
|
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('invoices', sa.Column('order_id', sa.INTEGER(), nullable=True))
|
|
op.create_foreign_key(None, 'invoices', 'orders', ['order_id'], ['id'])
|
|
op.add_column('orders', sa.Column('total_amount', sa.FLOAT(), nullable=False))
|
|
op.add_column('orders', sa.Column('balance_amount', sa.FLOAT(), nullable=False))
|
|
op.add_column('orders', sa.Column('applies_at', sa.DateTime(timezone=True), nullable=True))
|
|
op.add_column('orders', sa.Column('applied_at', sa.DateTime(timezone=True), nullable=True))
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
"""Downgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_column('orders', 'applied_at')
|
|
op.drop_column('orders', 'applies_at')
|
|
op.drop_column('orders', 'balance_amount')
|
|
op.drop_column('orders', 'total_amount')
|
|
op.drop_constraint(None, 'invoices', type_='foreignkey')
|
|
op.drop_column('invoices', 'order_id')
|
|
# ### end Alembic commands ###
|