if not exists(
	select * 
	from INFORMATION_SCHEMA.columns c 
	where c.table_name = 'T_BRANCH' and c.COLUMN_NAME = 'curationlevel')
BEGIN 
ALTER TABLE [AKUZ].[T_BRANCH] ADD [CurationLevel] int NULL 
END;

if not exists(
	select * 
	from INFORMATION_SCHEMA.columns c 
	where c.table_name = 'T_RESOURCE' and c.COLUMN_NAME = 'datamartpermission')
BEGIN 
ALTER TABLE [AKUZ].[T_RESOURCE] ADD [DatamartPermission] int NULL
UPDATE [AKUZ].[T_RESOURCE] SET [DatamartPermission] = 3
ALTER TABLE [AKUZ].[T_RESOURCE] ALTER COLUMN [DatamartPermission] int NOT NULL
END;

if not exists(
	select * 
	from INFORMATION_SCHEMA.columns c 
	where c.table_name = 'T_BRANCH' and c.COLUMN_NAME = 'datamartpermission')
BEGIN 
ALTER TABLE [AKUZ].[T_BRANCH] ADD [DatamartPermission] int NULL
UPDATE [AKUZ].[T_BRANCH] SET [DatamartPermission] = 3
ALTER TABLE [AKUZ].[T_BRANCH] ALTER COLUMN [DatamartPermission] int NOT NULL
END;

