do $$ begin
	IF EXISTS(select * from information_schema.columns WHERE table_name='T_CDA_LINKDOCS_SANATORY_CARD' and column_name='documentnote')
		then
			ALTER TABLE AKUZ.T_CDA_LINKDOCS_SANATORY_CARD ALTER COLUMN "documentnote" TYPE text;
			ALTER TABLE AKUZ.T_CDA_LINKDOCS_SANATORY_CARD ALTER COLUMN "documentnote" DROP NOT NULL;
		END IF;	
end; $$;