Imporve enterprise
This commit is contained in:
@@ -41,6 +41,12 @@ def upgrade():
|
||||
sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
|
||||
sa.Column('created_by', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column('updated_by', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
# VRP Optimization Metrics
|
||||
sa.Column('vrp_optimization_savings', sa.JSON(), nullable=True),
|
||||
sa.Column('vrp_algorithm_version', sa.String(length=50), nullable=True),
|
||||
sa.Column('vrp_optimization_timestamp', sa.DateTime(timezone=True), nullable=True),
|
||||
sa.Column('vrp_constraints_satisfied', sa.Boolean(), nullable=True),
|
||||
sa.Column('vrp_objective_value', sa.Float(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('route_number')
|
||||
)
|
||||
@@ -53,6 +59,8 @@ def upgrade():
|
||||
op.create_index('ix_delivery_routes_driver_id', 'delivery_routes', ['driver_id'])
|
||||
op.create_index('ix_delivery_routes_tenant_date', 'delivery_routes', ['tenant_id', 'route_date'])
|
||||
op.create_index('ix_delivery_routes_date_tenant_status', 'delivery_routes', ['route_date', 'tenant_id', 'status'])
|
||||
# VRP Optimization Index
|
||||
op.create_index('ix_delivery_routes_vrp_optimization', 'delivery_routes', ['vrp_optimization_timestamp'], unique=False)
|
||||
|
||||
|
||||
# Create shipments table
|
||||
@@ -156,6 +164,7 @@ def downgrade():
|
||||
op.drop_table('shipments')
|
||||
|
||||
# Drop indexes for delivery_routes
|
||||
op.drop_index('ix_delivery_routes_vrp_optimization', table_name='delivery_routes')
|
||||
op.drop_index('ix_delivery_routes_date_tenant_status', table_name='delivery_routes')
|
||||
op.drop_index('ix_delivery_routes_tenant_date', table_name='delivery_routes')
|
||||
op.drop_index('ix_delivery_routes_driver_id', table_name='delivery_routes')
|
||||
|
||||
Reference in New Issue
Block a user