CREATE TABLE [dbo].[ATTimer] (
    [Id] INT IDENTITY(1,1) NOT NULL,
    [EventID] INT NOT NULL,
    [ProcessID] INT NOT NULL,
    [TimeValue] INT NOT NULL,
    [ValueType] NVARCHAR(20) NOT NULL,
    CONSTRAINT [PK_ATTimer] PRIMARY KEY CLUSTERED ([Id]),
    CONSTRAINT [FK_ATTimer_EventID] FOREIGN KEY ([EventID]) REFERENCES [dbo].[ATEventDefinition]([EventID]),
    CONSTRAINT [FK_ATTimer_ProcessID] FOREIGN KEY ([ProcessID]) REFERENCES [dbo].[ATProcessDefinition]([ProcessID]),
    CONSTRAINT [CK_ATTimer_ValueType] CHECK ([ValueType] IN ('Minutes', 'Hours', 'Days', 'Months', 'Years'))
);
