"""initial_schema_20251015_1228

Revision ID: 3c4d0f57a312
Revises: 
Create Date: 2025-10-15 12:28:57.066635+02:00

"""
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 = '3c4d0f57a312'
down_revision: Union[str, None] = None
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('audit_logs',
    sa.Column('id', sa.UUID(), nullable=False),
    sa.Column('tenant_id', sa.UUID(), nullable=False),
    sa.Column('user_id', sa.UUID(), nullable=False),
    sa.Column('action', sa.String(length=100), nullable=False),
    sa.Column('resource_type', sa.String(length=100), nullable=False),
    sa.Column('resource_id', sa.String(length=255), nullable=True),
    sa.Column('severity', sa.String(length=20), nullable=False),
    sa.Column('service_name', sa.String(length=100), nullable=False),
    sa.Column('description', sa.Text(), nullable=True),
    sa.Column('changes', postgresql.JSON(astext_type=sa.Text()), nullable=True),
    sa.Column('audit_metadata', postgresql.JSON(astext_type=sa.Text()), nullable=True),
    sa.Column('ip_address', sa.String(length=45), nullable=True),
    sa.Column('user_agent', sa.Text(), nullable=True),
    sa.Column('endpoint', sa.String(length=255), nullable=True),
    sa.Column('method', sa.String(length=10), nullable=True),
    sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index('idx_audit_resource_type_action', 'audit_logs', ['resource_type', 'action'], unique=False)
    op.create_index('idx_audit_service_created', 'audit_logs', ['service_name', 'created_at'], unique=False)
    op.create_index('idx_audit_severity_created', 'audit_logs', ['severity', 'created_at'], unique=False)
    op.create_index('idx_audit_tenant_created', 'audit_logs', ['tenant_id', 'created_at'], unique=False)
    op.create_index('idx_audit_user_created', 'audit_logs', ['user_id', 'created_at'], unique=False)
    op.create_index(op.f('ix_audit_logs_action'), 'audit_logs', ['action'], unique=False)
    op.create_index(op.f('ix_audit_logs_created_at'), 'audit_logs', ['created_at'], unique=False)
    op.create_index(op.f('ix_audit_logs_resource_id'), 'audit_logs', ['resource_id'], unique=False)
    op.create_index(op.f('ix_audit_logs_resource_type'), 'audit_logs', ['resource_type'], unique=False)
    op.create_index(op.f('ix_audit_logs_service_name'), 'audit_logs', ['service_name'], unique=False)
    op.create_index(op.f('ix_audit_logs_severity'), 'audit_logs', ['severity'], unique=False)
    op.create_index(op.f('ix_audit_logs_tenant_id'), 'audit_logs', ['tenant_id'], unique=False)
    op.create_index(op.f('ix_audit_logs_user_id'), 'audit_logs', ['user_id'], unique=False)
    op.create_table('production_schedules',
    sa.Column('id', sa.UUID(), nullable=False),
    sa.Column('tenant_id', sa.UUID(), nullable=False),
    sa.Column('schedule_date', sa.DateTime(timezone=True), nullable=False),
    sa.Column('schedule_name', sa.String(length=255), nullable=True),
    sa.Column('total_planned_batches', sa.Integer(), nullable=False),
    sa.Column('total_planned_items', sa.Float(), nullable=False),
    sa.Column('estimated_production_hours', sa.Float(), nullable=True),
    sa.Column('estimated_material_cost', sa.Numeric(precision=10, scale=2), nullable=True),
    sa.Column('is_published', sa.Boolean(), nullable=True),
    sa.Column('is_completed', sa.Boolean(), nullable=True),
    sa.Column('completion_percentage', sa.Float(), nullable=True),
    sa.Column('available_staff_hours', sa.Float(), nullable=True),
    sa.Column('oven_capacity_hours', sa.Float(), nullable=True),
    sa.Column('production_capacity_limit', sa.Float(), nullable=True),
    sa.Column('schedule_notes', sa.Text(), nullable=True),
    sa.Column('preparation_instructions', sa.Text(), nullable=True),
    sa.Column('special_requirements', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
    sa.Column('created_at', sa.DateTime(timezone=True), nullable=True),
    sa.Column('updated_at', sa.DateTime(timezone=True), nullable=True),
    sa.Column('created_by', sa.UUID(), nullable=True),
    sa.Column('published_by', sa.UUID(), nullable=True),
    sa.Column('published_at', sa.DateTime(timezone=True), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index('idx_production_schedules_completed', 'production_schedules', ['tenant_id', 'is_completed', 'schedule_date'], unique=False)
    op.create_index('idx_production_schedules_published', 'production_schedules', ['tenant_id', 'is_published', 'schedule_date'], unique=False)
    op.create_index('idx_production_schedules_tenant_date', 'production_schedules', ['tenant_id', 'schedule_date'], unique=False)
    op.create_index(op.f('ix_production_schedules_schedule_date'), 'production_schedules', ['schedule_date'], unique=False)
    op.create_index(op.f('ix_production_schedules_tenant_id'), 'production_schedules', ['tenant_id'], unique=False)
    op.create_table('recipes',
    sa.Column('id', sa.UUID(), nullable=False),
    sa.Column('tenant_id', sa.UUID(), nullable=False),
    sa.Column('name', sa.String(length=255), nullable=False),
    sa.Column('recipe_code', sa.String(length=100), nullable=True),
    sa.Column('version', sa.String(length=20), nullable=False),
    sa.Column('finished_product_id', sa.UUID(), nullable=False),
    sa.Column('description', sa.Text(), nullable=True),
    sa.Column('category', sa.String(length=100), nullable=True),
    sa.Column('cuisine_type', sa.String(length=100), nullable=True),
    sa.Column('difficulty_level', sa.Integer(), nullable=False),
    sa.Column('yield_quantity', sa.Float(), nullable=False),
    sa.Column('yield_unit', sa.Enum('GRAMS', 'KILOGRAMS', 'MILLILITERS', 'LITERS', 'CUPS', 'TABLESPOONS', 'TEASPOONS', 'UNITS', 'PIECES', 'PERCENTAGE', name='measurementunit'), nullable=False),
    sa.Column('prep_time_minutes', sa.Integer(), nullable=True),
    sa.Column('cook_time_minutes', sa.Integer(), nullable=True),
    sa.Column('total_time_minutes', sa.Integer(), nullable=True),
    sa.Column('rest_time_minutes', sa.Integer(), nullable=True),
    sa.Column('estimated_cost_per_unit', sa.Numeric(precision=10, scale=2), nullable=True),
    sa.Column('last_calculated_cost', sa.Numeric(precision=10, scale=2), nullable=True),
    sa.Column('cost_calculation_date', sa.DateTime(timezone=True), nullable=True),
    sa.Column('target_margin_percentage', sa.Float(), nullable=True),
    sa.Column('suggested_selling_price', sa.Numeric(precision=10, scale=2), nullable=True),
    sa.Column('instructions', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
    sa.Column('preparation_notes', sa.Text(), nullable=True),
    sa.Column('storage_instructions', sa.Text(), nullable=True),
    sa.Column('quality_standards', sa.Text(), nullable=True),
    sa.Column('serves_count', sa.Integer(), nullable=True),
    sa.Column('nutritional_info', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
    sa.Column('allergen_info', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
    sa.Column('dietary_tags', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
    sa.Column('batch_size_multiplier', sa.Float(), nullable=False),
    sa.Column('minimum_batch_size', sa.Float(), nullable=True),
    sa.Column('maximum_batch_size', sa.Float(), nullable=True),
    sa.Column('optimal_production_temperature', sa.Float(), nullable=True),
    sa.Column('optimal_humidity', sa.Float(), nullable=True),
    sa.Column('quality_check_points', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
    sa.Column('quality_check_configuration', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
    sa.Column('common_issues', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
    sa.Column('status', sa.Enum('DRAFT', 'ACTIVE', 'TESTING', 'ARCHIVED', 'DISCONTINUED', name='recipestatus'), nullable=False),
    sa.Column('is_seasonal', sa.Boolean(), nullable=True),
    sa.Column('season_start_month', sa.Integer(), nullable=True),
    sa.Column('season_end_month', sa.Integer(), nullable=True),
    sa.Column('is_signature_item', sa.Boolean(), nullable=True),
    sa.Column('created_at', sa.DateTime(timezone=True), nullable=True),
    sa.Column('updated_at', sa.DateTime(timezone=True), nullable=True),
    sa.Column('created_by', sa.UUID(), nullable=True),
    sa.Column('updated_by', sa.UUID(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index('idx_recipes_category', 'recipes', ['tenant_id', 'category', 'status'], unique=False)
    op.create_index('idx_recipes_seasonal', 'recipes', ['tenant_id', 'is_seasonal', 'season_start_month', 'season_end_month'], unique=False)
    op.create_index('idx_recipes_signature', 'recipes', ['tenant_id', 'is_signature_item', 'status'], unique=False)
    op.create_index('idx_recipes_status', 'recipes', ['tenant_id', 'status'], unique=False)
    op.create_index('idx_recipes_tenant_name', 'recipes', ['tenant_id', 'name'], unique=False)
    op.create_index('idx_recipes_tenant_product', 'recipes', ['tenant_id', 'finished_product_id'], unique=False)
    op.create_index(op.f('ix_recipes_category'), 'recipes', ['category'], unique=False)
    op.create_index(op.f('ix_recipes_finished_product_id'), 'recipes', ['finished_product_id'], unique=False)
    op.create_index(op.f('ix_recipes_name'), 'recipes', ['name'], unique=False)
    op.create_index(op.f('ix_recipes_recipe_code'), 'recipes', ['recipe_code'], unique=False)
    op.create_index(op.f('ix_recipes_status'), 'recipes', ['status'], unique=False)
    op.create_index(op.f('ix_recipes_tenant_id'), 'recipes', ['tenant_id'], unique=False)
    op.create_table('production_batches',
    sa.Column('id', sa.UUID(), nullable=False),
    sa.Column('tenant_id', sa.UUID(), nullable=False),
    sa.Column('recipe_id', sa.UUID(), nullable=False),
    sa.Column('batch_number', sa.String(length=100), nullable=False),
    sa.Column('production_date', sa.DateTime(timezone=True), nullable=False),
    sa.Column('planned_start_time', sa.DateTime(timezone=True), nullable=True),
    sa.Column('actual_start_time', sa.DateTime(timezone=True), nullable=True),
    sa.Column('planned_end_time', sa.DateTime(timezone=True), nullable=True),
    sa.Column('actual_end_time', sa.DateTime(timezone=True), nullable=True),
    sa.Column('planned_quantity', sa.Float(), nullable=False),
    sa.Column('actual_quantity', sa.Float(), nullable=True),
    sa.Column('yield_percentage', sa.Float(), nullable=True),
    sa.Column('batch_size_multiplier', sa.Float(), nullable=False),
    sa.Column('status', sa.Enum('PLANNED', 'IN_PROGRESS', 'COMPLETED', 'FAILED', 'CANCELLED', name='productionstatus'), nullable=False),
    sa.Column('priority', sa.Enum('LOW', 'NORMAL', 'HIGH', 'URGENT', name='productionpriority'), nullable=False),
    sa.Column('assigned_staff', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
    sa.Column('production_notes', sa.Text(), nullable=True),
    sa.Column('quality_score', sa.Float(), nullable=True),
    sa.Column('quality_notes', sa.Text(), nullable=True),
    sa.Column('defect_rate', sa.Float(), nullable=True),
    sa.Column('rework_required', sa.Boolean(), nullable=True),
    sa.Column('planned_material_cost', sa.Numeric(precision=10, scale=2), nullable=True),
    sa.Column('actual_material_cost', sa.Numeric(precision=10, scale=2), nullable=True),
    sa.Column('labor_cost', sa.Numeric(precision=10, scale=2), nullable=True),
    sa.Column('overhead_cost', sa.Numeric(precision=10, scale=2), nullable=True),
    sa.Column('total_production_cost', sa.Numeric(precision=10, scale=2), nullable=True),
    sa.Column('cost_per_unit', sa.Numeric(precision=10, scale=2), nullable=True),
    sa.Column('production_temperature', sa.Float(), nullable=True),
    sa.Column('production_humidity', sa.Float(), nullable=True),
    sa.Column('oven_temperature', sa.Float(), nullable=True),
    sa.Column('baking_time_minutes', sa.Integer(), nullable=True),
    sa.Column('waste_quantity', sa.Float(), nullable=False),
    sa.Column('waste_reason', sa.String(length=255), nullable=True),
    sa.Column('efficiency_percentage', sa.Float(), nullable=True),
    sa.Column('customer_order_reference', sa.String(length=100), nullable=True),
    sa.Column('pre_order_quantity', sa.Float(), nullable=True),
    sa.Column('shelf_quantity', sa.Float(), nullable=True),
    sa.Column('created_at', sa.DateTime(timezone=True), nullable=True),
    sa.Column('updated_at', sa.DateTime(timezone=True), nullable=True),
    sa.Column('created_by', sa.UUID(), nullable=True),
    sa.Column('completed_by', sa.UUID(), nullable=True),
    sa.ForeignKeyConstraint(['recipe_id'], ['recipes.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index('idx_production_batches_batch_number', 'production_batches', ['tenant_id', 'batch_number'], unique=False)
    op.create_index('idx_production_batches_priority', 'production_batches', ['tenant_id', 'priority', 'planned_start_time'], unique=False)
    op.create_index('idx_production_batches_recipe', 'production_batches', ['recipe_id', 'production_date'], unique=False)
    op.create_index('idx_production_batches_status', 'production_batches', ['tenant_id', 'status', 'production_date'], unique=False)
    op.create_index('idx_production_batches_tenant_date', 'production_batches', ['tenant_id', 'production_date'], unique=False)
    op.create_index(op.f('ix_production_batches_batch_number'), 'production_batches', ['batch_number'], unique=False)
    op.create_index(op.f('ix_production_batches_production_date'), 'production_batches', ['production_date'], unique=False)
    op.create_index(op.f('ix_production_batches_recipe_id'), 'production_batches', ['recipe_id'], unique=False)
    op.create_index(op.f('ix_production_batches_status'), 'production_batches', ['status'], unique=False)
    op.create_index(op.f('ix_production_batches_tenant_id'), 'production_batches', ['tenant_id'], unique=False)
    op.create_table('recipe_ingredients',
    sa.Column('id', sa.UUID(), nullable=False),
    sa.Column('tenant_id', sa.UUID(), nullable=False),
    sa.Column('recipe_id', sa.UUID(), nullable=False),
    sa.Column('ingredient_id', sa.UUID(), nullable=False),
    sa.Column('quantity', sa.Float(), nullable=False),
    sa.Column('unit', sa.Enum('GRAMS', 'KILOGRAMS', 'MILLILITERS', 'LITERS', 'CUPS', 'TABLESPOONS', 'TEASPOONS', 'UNITS', 'PIECES', 'PERCENTAGE', name='measurementunit'), nullable=False),
    sa.Column('quantity_in_base_unit', sa.Float(), nullable=True),
    sa.Column('alternative_quantity', sa.Float(), nullable=True),
    sa.Column('alternative_unit', sa.Enum('GRAMS', 'KILOGRAMS', 'MILLILITERS', 'LITERS', 'CUPS', 'TABLESPOONS', 'TEASPOONS', 'UNITS', 'PIECES', 'PERCENTAGE', name='measurementunit'), nullable=True),
    sa.Column('preparation_method', sa.String(length=255), nullable=True),
    sa.Column('ingredient_notes', sa.Text(), nullable=True),
    sa.Column('is_optional', sa.Boolean(), nullable=True),
    sa.Column('ingredient_order', sa.Integer(), nullable=False),
    sa.Column('ingredient_group', sa.String(length=100), nullable=True),
    sa.Column('substitution_options', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
    sa.Column('substitution_ratio', sa.Float(), nullable=True),
    sa.Column('unit_cost', sa.Numeric(precision=10, scale=2), nullable=True),
    sa.Column('total_cost', sa.Numeric(precision=10, scale=2), nullable=True),
    sa.Column('cost_updated_at', sa.DateTime(timezone=True), nullable=True),
    sa.ForeignKeyConstraint(['recipe_id'], ['recipes.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index('idx_recipe_ingredients_group', 'recipe_ingredients', ['recipe_id', 'ingredient_group', 'ingredient_order'], unique=False)
    op.create_index('idx_recipe_ingredients_ingredient', 'recipe_ingredients', ['ingredient_id'], unique=False)
    op.create_index('idx_recipe_ingredients_recipe', 'recipe_ingredients', ['recipe_id', 'ingredient_order'], unique=False)
    op.create_index('idx_recipe_ingredients_tenant', 'recipe_ingredients', ['tenant_id', 'recipe_id'], unique=False)
    op.create_index(op.f('ix_recipe_ingredients_ingredient_id'), 'recipe_ingredients', ['ingredient_id'], unique=False)
    op.create_index(op.f('ix_recipe_ingredients_recipe_id'), 'recipe_ingredients', ['recipe_id'], unique=False)
    op.create_index(op.f('ix_recipe_ingredients_tenant_id'), 'recipe_ingredients', ['tenant_id'], unique=False)
    op.create_table('production_ingredient_consumption',
    sa.Column('id', sa.UUID(), nullable=False),
    sa.Column('tenant_id', sa.UUID(), nullable=False),
    sa.Column('production_batch_id', sa.UUID(), nullable=False),
    sa.Column('recipe_ingredient_id', sa.UUID(), nullable=False),
    sa.Column('ingredient_id', sa.UUID(), nullable=False),
    sa.Column('stock_id', sa.UUID(), nullable=True),
    sa.Column('planned_quantity', sa.Float(), nullable=False),
    sa.Column('actual_quantity', sa.Float(), nullable=False),
    sa.Column('unit', sa.Enum('GRAMS', 'KILOGRAMS', 'MILLILITERS', 'LITERS', 'CUPS', 'TABLESPOONS', 'TEASPOONS', 'UNITS', 'PIECES', 'PERCENTAGE', name='measurementunit'), nullable=False),
    sa.Column('variance_quantity', sa.Float(), nullable=True),
    sa.Column('variance_percentage', sa.Float(), nullable=True),
    sa.Column('unit_cost', sa.Numeric(precision=10, scale=2), nullable=True),
    sa.Column('total_cost', sa.Numeric(precision=10, scale=2), nullable=True),
    sa.Column('consumption_time', sa.DateTime(timezone=True), nullable=False),
    sa.Column('consumption_notes', sa.Text(), nullable=True),
    sa.Column('staff_member', sa.UUID(), nullable=True),
    sa.Column('ingredient_condition', sa.String(length=50), nullable=True),
    sa.Column('quality_impact', sa.String(length=255), nullable=True),
    sa.Column('substitution_used', sa.Boolean(), nullable=True),
    sa.Column('substitution_details', sa.Text(), nullable=True),
    sa.ForeignKeyConstraint(['production_batch_id'], ['production_batches.id'], ),
    sa.ForeignKeyConstraint(['recipe_ingredient_id'], ['recipe_ingredients.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index('idx_consumption_batch', 'production_ingredient_consumption', ['production_batch_id'], unique=False)
    op.create_index('idx_consumption_ingredient', 'production_ingredient_consumption', ['ingredient_id', 'consumption_time'], unique=False)
    op.create_index('idx_consumption_recipe_ingredient', 'production_ingredient_consumption', ['recipe_ingredient_id'], unique=False)
    op.create_index('idx_consumption_stock', 'production_ingredient_consumption', ['stock_id'], unique=False)
    op.create_index('idx_consumption_tenant', 'production_ingredient_consumption', ['tenant_id', 'consumption_time'], unique=False)
    op.create_index(op.f('ix_production_ingredient_consumption_ingredient_id'), 'production_ingredient_consumption', ['ingredient_id'], unique=False)
    op.create_index(op.f('ix_production_ingredient_consumption_production_batch_id'), 'production_ingredient_consumption', ['production_batch_id'], unique=False)
    op.create_index(op.f('ix_production_ingredient_consumption_recipe_ingredient_id'), 'production_ingredient_consumption', ['recipe_ingredient_id'], unique=False)
    op.create_index(op.f('ix_production_ingredient_consumption_stock_id'), 'production_ingredient_consumption', ['stock_id'], unique=False)
    op.create_index(op.f('ix_production_ingredient_consumption_tenant_id'), 'production_ingredient_consumption', ['tenant_id'], unique=False)
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_production_ingredient_consumption_tenant_id'), table_name='production_ingredient_consumption')
    op.drop_index(op.f('ix_production_ingredient_consumption_stock_id'), table_name='production_ingredient_consumption')
    op.drop_index(op.f('ix_production_ingredient_consumption_recipe_ingredient_id'), table_name='production_ingredient_consumption')
    op.drop_index(op.f('ix_production_ingredient_consumption_production_batch_id'), table_name='production_ingredient_consumption')
    op.drop_index(op.f('ix_production_ingredient_consumption_ingredient_id'), table_name='production_ingredient_consumption')
    op.drop_index('idx_consumption_tenant', table_name='production_ingredient_consumption')
    op.drop_index('idx_consumption_stock', table_name='production_ingredient_consumption')
    op.drop_index('idx_consumption_recipe_ingredient', table_name='production_ingredient_consumption')
    op.drop_index('idx_consumption_ingredient', table_name='production_ingredient_consumption')
    op.drop_index('idx_consumption_batch', table_name='production_ingredient_consumption')
    op.drop_table('production_ingredient_consumption')
    op.drop_index(op.f('ix_recipe_ingredients_tenant_id'), table_name='recipe_ingredients')
    op.drop_index(op.f('ix_recipe_ingredients_recipe_id'), table_name='recipe_ingredients')
    op.drop_index(op.f('ix_recipe_ingredients_ingredient_id'), table_name='recipe_ingredients')
    op.drop_index('idx_recipe_ingredients_tenant', table_name='recipe_ingredients')
    op.drop_index('idx_recipe_ingredients_recipe', table_name='recipe_ingredients')
    op.drop_index('idx_recipe_ingredients_ingredient', table_name='recipe_ingredients')
    op.drop_index('idx_recipe_ingredients_group', table_name='recipe_ingredients')
    op.drop_table('recipe_ingredients')
    op.drop_index(op.f('ix_production_batches_tenant_id'), table_name='production_batches')
    op.drop_index(op.f('ix_production_batches_status'), table_name='production_batches')
    op.drop_index(op.f('ix_production_batches_recipe_id'), table_name='production_batches')
    op.drop_index(op.f('ix_production_batches_production_date'), table_name='production_batches')
    op.drop_index(op.f('ix_production_batches_batch_number'), table_name='production_batches')
    op.drop_index('idx_production_batches_tenant_date', table_name='production_batches')
    op.drop_index('idx_production_batches_status', table_name='production_batches')
    op.drop_index('idx_production_batches_recipe', table_name='production_batches')
    op.drop_index('idx_production_batches_priority', table_name='production_batches')
    op.drop_index('idx_production_batches_batch_number', table_name='production_batches')
    op.drop_table('production_batches')
    op.drop_index(op.f('ix_recipes_tenant_id'), table_name='recipes')
    op.drop_index(op.f('ix_recipes_status'), table_name='recipes')
    op.drop_index(op.f('ix_recipes_recipe_code'), table_name='recipes')
    op.drop_index(op.f('ix_recipes_name'), table_name='recipes')
    op.drop_index(op.f('ix_recipes_finished_product_id'), table_name='recipes')
    op.drop_index(op.f('ix_recipes_category'), table_name='recipes')
    op.drop_index('idx_recipes_tenant_product', table_name='recipes')
    op.drop_index('idx_recipes_tenant_name', table_name='recipes')
    op.drop_index('idx_recipes_status', table_name='recipes')
    op.drop_index('idx_recipes_signature', table_name='recipes')
    op.drop_index('idx_recipes_seasonal', table_name='recipes')
    op.drop_index('idx_recipes_category', table_name='recipes')
    op.drop_table('recipes')
    op.drop_index(op.f('ix_production_schedules_tenant_id'), table_name='production_schedules')
    op.drop_index(op.f('ix_production_schedules_schedule_date'), table_name='production_schedules')
    op.drop_index('idx_production_schedules_tenant_date', table_name='production_schedules')
    op.drop_index('idx_production_schedules_published', table_name='production_schedules')
    op.drop_index('idx_production_schedules_completed', table_name='production_schedules')
    op.drop_table('production_schedules')
    op.drop_index(op.f('ix_audit_logs_user_id'), table_name='audit_logs')
    op.drop_index(op.f('ix_audit_logs_tenant_id'), table_name='audit_logs')
    op.drop_index(op.f('ix_audit_logs_severity'), table_name='audit_logs')
    op.drop_index(op.f('ix_audit_logs_service_name'), table_name='audit_logs')
    op.drop_index(op.f('ix_audit_logs_resource_type'), table_name='audit_logs')
    op.drop_index(op.f('ix_audit_logs_resource_id'), table_name='audit_logs')
    op.drop_index(op.f('ix_audit_logs_created_at'), table_name='audit_logs')
    op.drop_index(op.f('ix_audit_logs_action'), table_name='audit_logs')
    op.drop_index('idx_audit_user_created', table_name='audit_logs')
    op.drop_index('idx_audit_tenant_created', table_name='audit_logs')
    op.drop_index('idx_audit_severity_created', table_name='audit_logs')
    op.drop_index('idx_audit_service_created', table_name='audit_logs')
    op.drop_index('idx_audit_resource_type_action', table_name='audit_logs')
    op.drop_table('audit_logs')
    # ### end Alembic commands ###
