-- Clean-up VEPROMS before adding new ROFST Tables
USE VEPROMS

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DocVersionROFsts]') AND OBJECTPROPERTY(id,N'IsTable') = 1)
    Drop Table [DocVersionROFsts] 
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[Associations]') AND OBJECTPROPERTY(id,N'IsTable') = 1)
    Drop Table [Associations] 
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[ROFstImages]') AND OBJECTPROPERTY(id,N'IsTable') = 1)
    Drop Table [ROFstImages] 
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[Figures]') AND OBJECTPROPERTY(id,N'IsTable') = 1)
    Drop Table [Figures] 
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[ROFsts]') AND OBJECTPROPERTY(id,N'IsTable') = 1)
    Drop Table [ROFsts] 
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[ROImages]') AND OBJECTPROPERTY(id,N'IsTable') = 1)
    Drop Table [ROImages] 
GO
ALTER TABLE [dbo].[RoUsages]  DROP CONSTRAINT [FK_ROUsages_RODbs] --FOREIGN KEY([RODbID]) REFERENCES [dbo].[RODbs] ([RODbID])
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[RODbs]') AND OBJECTPROPERTY(id,N'IsTable') = 1)
    Drop Table [RODbs] 
GO
