
GO
BEGIN TRANSACTION;

GO
USE ION_Network

IF NOT EXISTS (SELECT ID FROM DeviceType WHERE Type ='8000')
INSERT INTO DeviceType (Type, DisplayName, EthernetSupport, SecurityModules, UsesFlashFile, IONBufferSize_bytes, TranslatorID, UnsolicitedTickPeriod_ms) 
SELECT '8000', 'PM8000', 2, 50, 0, 4096, [ID], 0 FROM Translator WHERE Name = 'ION';

IF EXISTS (SELECT ID FROM DeviceType WHERE Type ='8000' AND SecurityModules <> 50)
BEGIN
	UPDATE DeviceType SET SecurityModules = 50 WHERE Type = '8000'
END

IF (EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'DeviceTypeCategory'))
BEGIN
	IF NOT EXISTS (SELECT ID FROM DeviceTypeCategory WHERE Type ='8000')
		INSERT INTO DeviceTypeCategory (Type, Category, Reserved1) 
		SELECT '8000', 'M', '995722AA111B2B09EF8249538FFC449AF1CEC9FB1278069AFF09DDE0924CEAF2';
END

IF NOT EXISTS (SELECT ID FROM DeviceType WHERE Type ='9410')
INSERT INTO DeviceType (Type, DisplayName, EthernetSupport, SecurityModules, UsesFlashFile, IONBufferSize_bytes, TranslatorID, UnsolicitedTickPeriod_ms) 
SELECT '9410', '9410', 2, 50, 0, 4096, [ID], 0 FROM Translator WHERE Name = 'ION';

IF EXISTS (SELECT ID FROM DeviceType WHERE Type ='9410' AND SecurityModules <> 50)
BEGIN
	UPDATE DeviceType SET SecurityModules = 50 WHERE Type = '9410'
END

IF (EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'DeviceTypeCategory'))
BEGIN
	IF NOT EXISTS (SELECT ID FROM DeviceTypeCategory WHERE Type ='9410')
		INSERT INTO DeviceTypeCategory (Type, Category, Reserved1) 
		SELECT '9410', 'M', '668A9FBB0BD7FBF5ACFE3F9DD61EEB747D028763FF495FA1725B2E47BE4F0E70';
END


GO

EXEC[spCFG_AppendToItemValueByName] 'EN50160_V2010_Frameworks', '8000_FAC_V1.1.0.0.0', '&#183;'
EXEC[spCFG_AppendToItemValueByName] 'EN50160_V2010_Frameworks', '8000_FAC_PQ_V1.1.0', '&#183;'
EXEC[spCFG_AppendToItemValueByName] 'EN50160_V2010_Frameworks', '8000_FAC-PQ_V1.1.0.0.0', '&#183;'
EXEC[spCFG_AppendToItemValueByName] 'EN50160_V2010_Frameworks', '8000_FAC-PQ_V2.0.0', '&#183;'
EXEC[spCFG_AppendToItemValueByName] 'EN50160_V2010_Frameworks', '8000_V2.2.0', '&#183;'

EXEC[spCFG_AppendToItemValueByName] 'EN50160_V2010_Frameworks', '9410_SEA-PQ_V1.1.0', '&#183;'
EXEC[spCFG_AppendToItemValueByName] 'EN50160_V2010_Frameworks', '9410_SEA-PQ_V2.0.0', '&#183;'
EXEC[spCFG_AppendToItemValueByName] 'EN50160_V2010_Frameworks', '9410_V2.2.0', '&#183;'

GO

COMMIT TRANSACTION;  

GO
