-- Add customers table for tracking buyers CREATE EXTENSION IF NOT EXISTS "pgcrypto"; CREATE TABLE customers ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), name VARCHAR(255) NOT NULL, phone VARCHAR(50), city VARCHAR(255), notes TEXT, created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP ); -- Phone is the natural dedup key CREATE UNIQUE INDEX idx_customers_phone ON customers (phone) WHERE phone IS NOT NULL; CREATE INDEX idx_customers_name ON customers (name);