CREATE TABLE [dbo].[ATButton] (
    [Id]         INT              NOT NULL IDENTITY (1,1),
    [ButtonName]  NVARCHAR (255)   NOT NULL,
    [ButtonValue] NVARCHAR (255)   NULL,
    [ButtonIndex] INT              NOT NULL,
    [QueueId]      INT              NOT NULL,
    [HelpText]   NVARCHAR (255)   NULL,
    [Tag]        NVARCHAR (255)   NULL,
    [ObjectId]   UNIQUEIDENTIFIER NOT NULL,
    [EventId]    INT              NOT NULL,
    CONSTRAINT [PK_ATButton] PRIMARY KEY CLUSTERED ([Id] ASC),
    CONSTRAINT [UK_ATButton] UNIQUE ([ObjectId]),
    CONSTRAINT [UK_Name_Queue] UNIQUE ([ButtonName], [QueueId]),
    CONSTRAINT [FK_ATButton_ATQueue] FOREIGN KEY ([QueueId]) REFERENCES [dbo].[ATQueue] ([Id]),
    CONSTRAINT [FK_ATButton_ATEvent] FOREIGN KEY ([EventId]) REFERENCES [dbo].[ATEventDefinition] ([EventID])
);

