 ALTER TABLE CSM_GROUP DROP CONSTRAINT FK_CSM_GROUP_CSM_APPLICATION
 ;
 
+IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id('FK_APPLICATION_FILTER_CLAUSE') AND OBJECTPROPERTY(id, 'IsForeignKey') = 1)
+ALTER TABLE CSM_FILTER_CLAUSE DROP CONSTRAINT FK_APPLICATION_FILTER_CLAUSE
+;
+
 IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id('FK_PG_PE_PE') AND OBJECTPROPERTY(id, 'IsForeignKey') = 1)
 ALTER TABLE CSM_PG_PE DROP CONSTRAINT FK_PG_PE_PE
 ;

FOREIGN KEY (APPLICATION_ID) REFERENCES CSM_APPLICATION (APPLICATION_ID)
ON DELETE CASCADE
;

ALTER TABLE CSM_PG_PE ADD CONSTRAINT FK_PG_PE_PE 
FOREIGN KEY (PROTECTION_ELEMENT_ID) REFERENCES CSM_PROTECTION_ELEMENT (PROTECTION_ELEMENT_ID)


CREATE TABLE CSM_USER ( 
	USER_ID int identity(1,1)  NOT NULL,
	LOGIN_NAME varchar(500) NOT NULL,
	PREMGRT_LOGIN_NAME varchar(100) NOT NULL,
	MIGRATED_FLAG int NOT NULL DEFAULT 0,
	FIRST_NAME varchar(100) NOT NULL,
	LAST_NAME varchar(100) NOT NULL,
	ORGANIZATION varchar(100),
