CREATE TABLE [dbo].[ATExportEvent] (
    [Id]          INT            NOT NULL IDENTITY(1,1),
    [EventId]     INT            NOT NULL,
    [TemplateId]  INT            NOT NULL,
    [Order]       INT            NOT NULL,
    [Description] NVARCHAR(500)  NOT NULL,
    CONSTRAINT [PK_ATExportEvent] PRIMARY KEY CLUSTERED ([Id] ASC),
    CONSTRAINT [UK_ATExportEvent_EventId_TemplateId_Order] UNIQUE ([EventId] ASC, [TemplateId] ASC, [Order] ASC),
    CONSTRAINT [FK_ATExportEvent_EventId] FOREIGN KEY ([EventId]) REFERENCES [dbo].[ATEventDefinition] ([EventId]),
    CONSTRAINT [FK_ATExportEvent_TemplateId] FOREIGN KEY ([TemplateId]) REFERENCES [dbo].[ATTemplates] ([Id])
);