-- Tables

-- Alters

IF NOT EXISTS (SELECT 1 FROM sys.foreign_keys WHERE name = 'FK_T_ENUMS_T_EHR_TYPE_MEDICAL_DEVICES_HISTORY_ChangeType' AND parent_object_id = OBJECT_ID('[IES].[T_EHR_TYPE_MEDICAL_DEVICES_HISTORY]'))
BEGIN

     ALTER TABLE [IES].[T_EHR_TYPE_MEDICAL_DEVICES_HISTORY] ADD CONSTRAINT [FK_T_ENUMS_T_EHR_TYPE_MEDICAL_DEVICES_HISTORY_ChangeType]
     FOREIGN KEY([ChangeType]) REFERENCES [VCLib].[T_ENUMS] ([EnumID])

END

GO

