-- Migration: Add warehouse columns to locations table
-- Created: 2025-10-22
-- Description: Adds code, type, and address columns to locations table for warehouse management

-- Add new columns
ALTER TABLE locations ADD COLUMN IF NOT EXISTS code varchar(50);
ALTER TABLE locations ADD COLUMN IF NOT EXISTS type varchar(50);
ALTER TABLE locations ADD COLUMN IF NOT EXISTS address text;

-- Add index on code for faster lookups
CREATE INDEX IF NOT EXISTS idx_locations_code ON locations(code);
CREATE INDEX IF NOT EXISTS idx_locations_type ON locations(type);

-- Add comment
COMMENT ON COLUMN locations.code IS 'Warehouse/location code for identification';
COMMENT ON COLUMN locations.type IS 'Type of location: warehouse, store, transit, etc.';
COMMENT ON COLUMN locations.address IS 'Physical address of the location';
