Add improved production UI 3
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
"""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')
|
||||
@@ -112,6 +112,7 @@ class Recipe(Base):
|
||||
|
||||
# Quality control
|
||||
quality_check_points = Column(JSONB, nullable=True) # Key checkpoints during production
|
||||
quality_check_configuration = Column(JSONB, nullable=True) # Stage-based quality check config
|
||||
common_issues = Column(JSONB, nullable=True) # Known issues and solutions
|
||||
|
||||
# Status and lifecycle
|
||||
@@ -180,6 +181,7 @@ class Recipe(Base):
|
||||
'optimal_production_temperature': self.optimal_production_temperature,
|
||||
'optimal_humidity': self.optimal_humidity,
|
||||
'quality_check_points': self.quality_check_points,
|
||||
'quality_check_configuration': self.quality_check_configuration,
|
||||
'common_issues': self.common_issues,
|
||||
'status': self.status.value if self.status else None,
|
||||
'is_seasonal': self.is_seasonal,
|
||||
|
||||
Reference in New Issue
Block a user