fix: Resolve build errors and add database migrations
- Fix frontend import: Change from useAppContext to useTenant store - Fix backend imports: Use app.core.database instead of shared.database - Remove auth dependencies from dashboard endpoints - Add database migrations for reasoning fields in procurement and production Migrations: - procurement: Add reasoning, consequence, reasoning_data to purchase_orders - production: Add reasoning, reasoning_data to production_batches
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
"""add reasoning fields to purchase orders
|
||||
|
||||
Revision ID: 20251107_add_reasoning_fields
|
||||
Revises: 20251030_0737_9450f58f3623
|
||||
Create Date: 2025-11-07
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '20251107_add_reasoning_fields'
|
||||
down_revision = '20251030_0737_9450f58f3623'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# Add reasoning fields to purchase_orders table
|
||||
op.add_column('purchase_orders', sa.Column('reasoning', sa.Text(), nullable=True))
|
||||
op.add_column('purchase_orders', sa.Column('consequence', sa.Text(), nullable=True))
|
||||
op.add_column('purchase_orders', sa.Column('reasoning_data', postgresql.JSONB(astext_type=sa.Text()), nullable=True))
|
||||
|
||||
|
||||
def downgrade():
|
||||
# Remove reasoning fields from purchase_orders table
|
||||
op.drop_column('purchase_orders', 'reasoning_data')
|
||||
op.drop_column('purchase_orders', 'consequence')
|
||||
op.drop_column('purchase_orders', 'reasoning')
|
||||
Reference in New Issue
Block a user