-- Migration: Add new fields to quotes table for enhanced RFQ form
-- Created: 2026-04-30
-- Note: Columns are added individually to handle existing columns gracefully

-- Add address fields
ALTER TABLE quotes ADD COLUMN customer_address TEXT NULL COMMENT 'Full address as single text block';
ALTER TABLE quotes ADD COLUMN customer_zip VARCHAR(20) NULL COMMENT 'ZIP/Postal Code';
ALTER TABLE quotes ADD COLUMN customer_country VARCHAR(100) NULL COMMENT 'Country';

-- Add project and notes fields
ALTER TABLE quotes ADD COLUMN project_name VARCHAR(255) NULL COMMENT 'Project reference name';
ALTER TABLE quotes ADD COLUMN notes TEXT NULL COMMENT 'Additional notes from customer';

-- Add attachment fields
ALTER TABLE quotes ADD COLUMN attachment_name VARCHAR(255) NULL COMMENT 'Original filename of attachment';
ALTER TABLE quotes ADD COLUMN attachment_type VARCHAR(100) NULL COMMENT 'MIME type of attachment';
ALTER TABLE quotes ADD COLUMN attachment_data LONGTEXT NULL COMMENT 'Base64 encoded file data';

-- Create indexes for better search performance
CREATE INDEX idx_quotes_project_name ON quotes(project_name);
CREATE INDEX idx_quotes_country ON quotes(customer_country);
