-- Extend VARCHAR fields in organization table to handle longer values from TED data
-- Author: Martin.Schweitzer@procon.co.at and claude.ai

-- Extend postal_code (was VARCHAR(50), sometimes contains full addresses)
ALTER TABLE ted.organization ALTER COLUMN postal_code TYPE TEXT;

-- Extend street_name (was VARCHAR(50), sometimes very long)
ALTER TABLE ted.organization ALTER COLUMN street_name TYPE TEXT;

-- Extend city (was VARCHAR(100), can be extremely long - some have >255 chars)
ALTER TABLE ted.organization ALTER COLUMN city TYPE TEXT;

-- Extend phone (was VARCHAR(50), international numbers can be longer)
ALTER TABLE ted.organization ALTER COLUMN phone TYPE VARCHAR(100);

-- Extend org_reference (was VARCHAR(50), sometimes longer internal references)
ALTER TABLE ted.organization ALTER COLUMN org_reference TYPE VARCHAR(100);

-- Extend role (was VARCHAR(50), enum-like field but allow more space)
ALTER TABLE ted.organization ALTER COLUMN role TYPE VARCHAR(100);

-- Extend company_id (was VARCHAR(100), can contain very long registration info)
-- Example: 'KRS pod numerem: 0000070678, REGON: 016134981, NIP: 9521822413' (67 chars)
ALTER TABLE ted.organization ALTER COLUMN company_id TYPE TEXT;

-- Extend name (was TEXT already in V1, but ensure it's TEXT)
-- Contains full organization names which can be very long
ALTER TABLE ted.organization ALTER COLUMN name TYPE TEXT;
