IF NOT EXISTS(SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'NB_Channel' AND COLUMN_NAME = 'Created')
BEGIN
	ALTER TABLE [dbo].[NB_Channel] ADD Created datetimeoffset NOT NULL DEFAULT(SYSDATETIMEOFFSET());
END;

IF NOT EXISTS(SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'NB_Channel' AND COLUMN_NAME = 'Modified')
BEGIN
	ALTER TABLE [dbo].[NB_Channel] ADD Modified datetimeoffset NOT NULL DEFAULT(SYSDATETIMEOFFSET());
END;

IF NOT EXISTS(SELECT * FROM sys.indexes WHERE name='NB_Channel_Modified' AND object_id = OBJECT_ID('NB_Channel'))
BEGIN
	CREATE INDEX NB_Channel_Modified
	ON dbo.NB_Channel (Modified)
END;
