﻿INSERT INTO [dbo].[ChannelSettings]([SettingName], [DefaultValue]) VALUES ('SquibLimitDuration', 'True');
INSERT INTO [dbo].[ChannelSettings]([SettingName], [DefaultValue]) VALUES ('SquibDuration', '10');
INSERT INTO [dbo].[ChannelSettings]([SettingName], [DefaultValue]) VALUES ('SquibDelay', '0');
INSERT INTO [dbo].[ChannelSettings]([SettingName], [DefaultValue]) VALUES ('DigitalOutLimitDuration', 'True');
INSERT INTO [dbo].[ChannelSettings]([SettingName], [DefaultValue]) VALUES ('DigitalOutDuration', '10');
INSERT INTO [dbo].[ChannelSettings]([SettingName], [DefaultValue]) VALUES ('DigitalOutDelay', '0');
INSERT INTO [dbo].[ChannelSettings]([SettingName], [DefaultValue]) VALUES ('SquibCurrent', '1.5');

UPDATE [dbo].[ChannelSettings] SET [DefaultValue]='2' WHERE [SettingName]='SQMode' AND [DefaultValue]='1';

INSERT INTO [dbo].[GroupChannelSettings] ( [ChannelId],[SettingId], [SettingValue] )
SELECT  [dbo].[GroupChannelSettings].[ChannelId],13,[dbo].[GroupChannelSettings].[SettingValue]
FROM    [dbo].[GroupChannelSettings]
WHERE   [SettingId]=5;

INSERT INTO [dbo].[GroupChannelSettings] ( [ChannelId],[SettingId], [SettingValue] )
SELECT  [dbo].[GroupChannelSettings].[ChannelId],14,[dbo].[GroupChannelSettings].[SettingValue]
FROM    [dbo].[GroupChannelSettings]
WHERE   [SettingId]=6;

INSERT INTO [dbo].[GroupChannelSettings] ( [ChannelId],[SettingId], [SettingValue] )
SELECT  [dbo].[GroupChannelSettings].[ChannelId],15,[dbo].[GroupChannelSettings].[SettingValue]
FROM    [dbo].[GroupChannelSettings]
WHERE   [SettingId]=7;

INSERT INTO [dbo].[GroupChannelSettings] ( [ChannelId],[SettingId], [SettingValue] )
SELECT  [dbo].[GroupChannelSettings].[ChannelId],16,[dbo].[GroupChannelSettings].[SettingValue]
FROM    [dbo].[GroupChannelSettings]
WHERE   [SettingId]=5;

INSERT INTO [dbo].[GroupChannelSettings] ( [ChannelId],[SettingId], [SettingValue] )
SELECT  [dbo].[GroupChannelSettings].[ChannelId],17,[dbo].[GroupChannelSettings].[SettingValue]
FROM    [dbo].[GroupChannelSettings]
WHERE   [SettingId]=6;

INSERT INTO [dbo].[GroupChannelSettings] ( [ChannelId],[SettingId], [SettingValue] )
SELECT  [dbo].[GroupChannelSettings].[ChannelId],18,[dbo].[GroupChannelSettings].[SettingValue]
FROM    [dbo].[GroupChannelSettings]
WHERE   [SettingId]=7;

DELETE FROM [dbo].[GroupChannelSettings] WHERE [SettingId] IN (4,5,6,7);

DELETE FROM [dbo].[ChannelSettings] WHERE [Id] IN (4,5,6,7)