\set ON_ERROR_STOP 1
BEGIN;

ALTER TABLE medium
    ALTER COLUMN name SET DATA TYPE VARCHAR USING COALESCE(name, ''),
    ALTER COLUMN name SET NOT NULL,
    ALTER COLUMN name SET DEFAULT '';

COMMIT;
