CREATE TABLE [dbo].[ATFieldInstanceString] (
    [FieldInstanceID] INT            NOT NULL IDENTITY(1,1),
    [FieldID]         INT            NOT NULL,
    [FieldValue]      NVARCHAR (255) NULL,
    [WorkItemID]      INT            NOT NULL,
    [FieldName]       NVARCHAR (64)  NOT NULL,
    CONSTRAINT [PK_ATFieldInstanceString] PRIMARY KEY NONCLUSTERED ([FieldInstanceID] ASC),
    CONSTRAINT [ATFieldInstanceString_ATFieldDefinition] FOREIGN KEY ([FieldID]) REFERENCES [dbo].[ATFieldDefinition] ([FieldID]),
    CONSTRAINT [ATFieldInstanceString_ATWorkItem] FOREIGN KEY ([WorkItemID]) REFERENCES [dbo].[ATWorkItem] ([WorkItemId])
);


GO
CREATE NONCLUSTERED INDEX [ATFieldInstanceString_IX_FId]
    ON [dbo].[ATFieldInstanceString]([FieldID] ASC);


GO
CREATE NONCLUSTERED INDEX [ATFieldInstanceString_IX_FName]
    ON [dbo].[ATFieldInstanceString]([FieldName] ASC);


GO
CREATE NONCLUSTERED INDEX [ATFieldInstanceString_IX_WIId]
    ON [dbo].[ATFieldInstanceString]([WorkItemID] ASC);

