-- Make invoices.created_by nullable
-- This allows invoices to be created without a valid user reference
-- Useful for system-generated or imported invoices

ALTER TABLE invoices
ALTER COLUMN created_by DROP NOT NULL;

-- Also update the foreign key constraint to allow null
-- (It should already allow null after the column change, but let's be explicit)
