Files
Projects-plastic/migration.sql
Marcelo b66cb97f16 MVP
2025-11-28 09:11:59 -06:00

20 lines
580 B
SQL

-- Database Migration for Graph Reload and Work Order Persistence
-- Run this SQL on your plastico_oee database
-- Add cycle_count column to persist production cycles
ALTER TABLE work_orders ADD COLUMN cycle_count INT DEFAULT 0;
-- Add index for efficient graph queries by time range
CREATE INDEX idx_work_orders_updated_at ON work_orders(updated_at);
-- Verify columns exist
SELECT
COLUMN_NAME,
DATA_TYPE,
IS_NULLABLE,
COLUMN_DEFAULT
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'work_orders'
AND TABLE_SCHEMA = DATABASE()
ORDER BY ORDINAL_POSITION;