This commit is contained in:
Iliyan Angelov
2025-11-20 02:18:52 +02:00
parent 34b4c969d4
commit 44e11520c5
55 changed files with 4741 additions and 876 deletions

View File

@@ -0,0 +1,34 @@
"""add_promotion_fields_to_bookings
Revision ID: bd309b0742c1
Revises: f1a2b3c4d5e6
Create Date: 2025-11-20 02:16:09.496685
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'bd309b0742c1'
down_revision = 'f1a2b3c4d5e6'
branch_labels = None
depends_on = None
def upgrade() -> None:
# Add promotion-related columns to bookings table
op.add_column('bookings', sa.Column('original_price', sa.Numeric(10, 2), nullable=True))
op.add_column('bookings', sa.Column('discount_amount', sa.Numeric(10, 2), nullable=True, server_default='0'))
op.add_column('bookings', sa.Column('promotion_code', sa.String(50), nullable=True))
# Add index on promotion_code for faster lookups
op.create_index(op.f('ix_bookings_promotion_code'), 'bookings', ['promotion_code'], unique=False)
def downgrade() -> None:
# Remove promotion-related columns
op.drop_index(op.f('ix_bookings_promotion_code'), table_name='bookings')
op.drop_column('bookings', 'promotion_code')
op.drop_column('bookings', 'discount_amount')
op.drop_column('bookings', 'original_price')

View File

@@ -0,0 +1,27 @@
"""add_is_proforma_to_invoices
Revision ID: f1a2b3c4d5e6
Revises: d9aff6c5f0d4
Create Date: 2025-11-20 00:20:00.000000
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'f1a2b3c4d5e6'
down_revision = 'd9aff6c5f0d4'
branch_labels = None
depends_on = None
def upgrade() -> None:
# Add is_proforma column to invoices table
op.add_column('invoices', sa.Column('is_proforma', sa.Boolean(), nullable=False, server_default='0'))
def downgrade() -> None:
# Remove is_proforma column
op.drop_column('invoices', 'is_proforma')