41 lines
1.0 KiB
Python
41 lines
1.0 KiB
Python
"""Add quality check configuration to recipes
|
|
|
|
Revision ID: 004
|
|
Revises: 003
|
|
Create Date: 2024-01-15 10:00:00.000000
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects import postgresql
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '004'
|
|
down_revision = '003'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
"""Upgrade database schema to add quality check configuration"""
|
|
|
|
# Add quality_check_configuration column to recipes table
|
|
op.add_column('recipes', sa.Column('quality_check_configuration', postgresql.JSONB, nullable=True))
|
|
|
|
# Create index for better performance on quality configuration queries
|
|
op.create_index(
|
|
'ix_recipes_quality_check_configuration',
|
|
'recipes',
|
|
['quality_check_configuration'],
|
|
postgresql_using='gin'
|
|
)
|
|
|
|
|
|
def downgrade():
|
|
"""Downgrade database schema"""
|
|
|
|
# Drop index
|
|
op.drop_index('ix_recipes_quality_check_configuration')
|
|
|
|
# Remove quality_check_configuration column
|
|
op.drop_column('recipes', 'quality_check_configuration') |