BEGIN;

DO $$
BEGIN
    BEGIN
        ALTER TABLE trace_entry ADD COLUMN object_name varchar(255);
    EXCEPTION
        WHEN duplicate_column THEN
        -- do nothing
    END;
END;
$$;

UPDATE trace_entry SET object_name='' WHERE object_name IS NULL;

COMMIT;