-- Migration: Add lot_category column to lot table
-- Run this migration manually on the database

-- Add lot_category column to lot table
ALTER TABLE lot ADD COLUMN lot_category VARCHAR(50) DEFAULT NULL;

-- Create index for faster lookups
CREATE INDEX idx_lot_category ON lot(lot_category);

-- Update existing lots: extract category from lot_name (first part before underscore)
UPDATE lot SET lot_category = SUBSTRING_INDEX(lot_name, '_', 1) WHERE lot_category IS NULL;
