IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[RDS].[T_ELECTRONIC_CERTIFICATE_MESSAGE]') AND name = N'UQ_T_ELECTRONIC_CERTIFICATE_MESSAGE_CertificateApplicationEgissoStatus' and is_unique_constraint <> 1)
DROP INDEX [UQ_T_ELECTRONIC_CERTIFICATE_MESSAGE_CertificateApplicationEgissoStatus] ON [RDS].[T_ELECTRONIC_CERTIFICATE_MESSAGE]
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[RDS].[T_ELECTRONIC_CERTIFICATE_MESSAGE]') AND name = N'UQ_T_ELECTRONIC_CERTIFICATE_MESSAGE_CertificateApplicationEgissoStatus' and is_unique_constraint = 1)
ALTER TABLE [RDS].[T_ELECTRONIC_CERTIFICATE_MESSAGE] DROP CONSTRAINT [UQ_T_ELECTRONIC_CERTIFICATE_MESSAGE_CertificateApplicationEgissoStatus]
IF  EXISTS (SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[RDS].[T_ELECTRONIC_CERTIFICATE_MESSAGE]') AND name = N'CertificateApplicationEgissoStatus_UQ')
ALTER TABLE [RDS].[T_ELECTRONIC_CERTIFICATE_MESSAGE] DROP COLUMN [CertificateApplicationEgissoStatus_UQ]
GO

IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[RDS].[T_ELECTRONIC_CERTIFICATE_MESSAGE]') AND name = N'UQ_T_ELECTRONIC_CERTIFICATE_MESSAGE_ElectronicCertificateStatus' and is_unique_constraint <> 1)
DROP INDEX [UQ_T_ELECTRONIC_CERTIFICATE_MESSAGE_ElectronicCertificateStatus] ON [RDS].[T_ELECTRONIC_CERTIFICATE_MESSAGE]
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[RDS].[T_ELECTRONIC_CERTIFICATE_MESSAGE]') AND name = N'UQ_T_ELECTRONIC_CERTIFICATE_MESSAGE_ElectronicCertificateStatus' and is_unique_constraint = 1)
ALTER TABLE [RDS].[T_ELECTRONIC_CERTIFICATE_MESSAGE] DROP CONSTRAINT [UQ_T_ELECTRONIC_CERTIFICATE_MESSAGE_ElectronicCertificateStatus]
IF  EXISTS (SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[RDS].[T_ELECTRONIC_CERTIFICATE_MESSAGE]') AND name = N'ElectronicCertificateStatus_UQ')
ALTER TABLE [RDS].[T_ELECTRONIC_CERTIFICATE_MESSAGE] DROP COLUMN [ElectronicCertificateStatus_UQ]
GO

ALTER TABLE [RDS].[T_CERTIFICATE_APPLICATION_EGISSO_STATUS] ADD [EgissoStatus] int NULL
GO

ALTER TABLE [RDS].[T_CERTIFICATE_APPLICATION_EGISSO_STATUS] ADD [EgissoVerificationDate] datetime NULL
GO

ALTER TABLE [RDS].[T_ELECTRONIC_CERTIFICATE_STATUS] ADD [EgissoStatus] int NULL
GO

ALTER TABLE [RDS].[T_ELECTRONIC_CERTIFICATE_STATUS] ADD [EgissoVerificationDate] datetime NULL
GO

