 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
 ;

PRIMARY KEY (APPLICATION_ID) 
;

ALTER TABLE CSM_GROUP ADD CONSTRAINT PK_GROUP 
PRIMARY KEY (GROUP_ID) 
;


IF EXISTS (SELECT * FROM dbo.SYSOBJECTS WHERE id = object_id('CSM_APPLICATION') AND  OBJECTPROPERTY(id, 'IsUserTable') = 1)
DROP TABLE CSM_APPLICATION
;

IF EXISTS (SELECT * FROM dbo.SYSOBJECTS WHERE id = object_id('CSM_FILTER_CLAUSE') AND  OBJECTPROPERTY(id, 'IsUserTable') = 1)
DROP TABLE CSM_FILTER_CLAUSE
;

IF EXISTS (SELECT * FROM dbo.SYSOBJECTS WHERE id = object_id('CSM_GROUP') AND  OBJECTPROPERTY(id, 'IsUserTable') = 1)
