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

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

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