do $$ begin
if(exists(
	SELECT *
  	FROM information_schema.columns
 	WHERE table_schema = 'akuz' AND table_name   = 't_rds_synchronisation_errors' and column_name = 'hastextcontent' ))
then
	ALTER TABLE akuz.t_rds_synchronisation_errors DROP COLUMN HasTextContent;
end if;
end; $$;

ALTER TABLE AKUZ.T_RDS_SYNCHRONISATION_ERRORS ALTER COLUMN "contents" SET DATA TYPE varchar;

ALTER TABLE AKUZ.T_RDS_SYNCHRONISATION_ERRORS ALTER COLUMN "textcontent" SET DATA TYPE varchar;

ALTER TABLE AKUZ.T_RDS_SYNCHRONISATION_ERRORS ALTER COLUMN "error" SET DATA TYPE varchar;

ALTER TABLE akuz.t_rds_synchronisation_errors ADD HasTextContent boolean GENERATED ALWAYS AS ((case when TextContent IS NOT NULL then '1' else '0' end)::boolean) STORED;