DO $$ 
begin
	
	if(not exists(
		SELECT *
	  	FROM information_schema.columns
	 	WHERE table_schema = 'rds' AND table_name   = 't_synchronisation_errors' and column_name = 'hasbytecontent' ))
	then
		ALTER TABLE rds.t_synchronisation_errors ADD hasbytecontent boolean GENERATED ALWAYS AS ((case when ByteContent IS NOT NULL then '1' else '0' end)::boolean) STORED;
	end if;
	
	if(not exists(
		SELECT *
	  	FROM information_schema.columns
	 	WHERE table_schema = 'rds' AND table_name   = 't_synchronisation_errors' and column_name = 'hastextcontent' ))
	then
		ALTER TABLE rds.t_synchronisation_errors ADD hastextcontent boolean GENERATED ALWAYS AS ((case when Contents IS NOT NULL then '1' else '0' end)::boolean) STORED;
	end if;
end;
$$
