[12878] | 1 | /* HeuristicLab
|
---|
[14185] | 2 | * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
[12878] | 3 | *
|
---|
| 4 | * This file is part of HeuristicLab.
|
---|
| 5 | *
|
---|
| 6 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
| 7 | * it under the terms of the GNU General Public License as published by
|
---|
| 8 | * the Free Software Foundation, either version 3 of the License, or
|
---|
| 9 | * (at your option) any later version.
|
---|
| 10 | *
|
---|
| 11 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 14 | * GNU General Public License for more details.
|
---|
| 15 | *
|
---|
| 16 | * You should have received a copy of the GNU General Public License
|
---|
| 17 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 18 | */
|
---|
[16117] | 19 | USE [HeuristicLab.Hive-3.4]
|
---|
[6983] | 20 |
|
---|
[9665] | 21 | EXEC sp_configure filestream_access_level, 2
|
---|
| 22 | GO
|
---|
| 23 | RECONFIGURE
|
---|
| 24 | GO
|
---|
| 25 |
|
---|
[6983] | 26 | SET ARITHABORT ON
|
---|
[16117] | 27 |
|
---|
| 28 | CREATE TABLE [dbo].[AssignedProjectResource](
|
---|
[6983] | 29 | [ResourceId] UniqueIdentifier NOT NULL,
|
---|
[16117] | 30 | [ProjectId] UniqueIdentifier NOT NULL,
|
---|
| 31 | CONSTRAINT [PK_dbo.ResourceIdProjectId] PRIMARY KEY ([ResourceId], [ProjectId])
|
---|
[6983] | 32 | )
|
---|
[16117] | 33 | CREATE TABLE [dbo].[AssignedJobResource](
|
---|
| 34 | [ResourceId] UniqueIdentifier NOT NULL,
|
---|
| 35 | [JobId] UniqueIdentifier NOT NULL,
|
---|
| 36 | CONSTRAINT [PK_dbo.ResourceIdJobId] PRIMARY KEY ([ResourceId], [JobId])
|
---|
| 37 | )
|
---|
[6983] | 38 | CREATE TABLE [dbo].[Plugin](
|
---|
[7847] | 39 | [PluginId] UniqueIdentifier NOT NULL,
|
---|
| 40 | [Name] VarChar(MAX) NOT NULL,
|
---|
| 41 | [Version] VarChar(MAX) NOT NULL,
|
---|
| 42 | [UserId] UniqueIdentifier NOT NULL,
|
---|
| 43 | [DateCreated] DateTime NOT NULL,
|
---|
| 44 | [Hash] VarBinary(20) NOT NULL,
|
---|
[6983] | 45 | CONSTRAINT [PK_dbo.Plugin] PRIMARY KEY ([PluginId])
|
---|
| 46 | )
|
---|
| 47 | CREATE TABLE [dbo].[RequiredPlugins](
|
---|
[7847] | 48 | [RequiredPluginId] UniqueIdentifier NOT NULL,
|
---|
| 49 | [TaskId] UniqueIdentifier NOT NULL,
|
---|
| 50 | [PluginId] UniqueIdentifier NOT NULL,
|
---|
[6983] | 51 | CONSTRAINT [PK_dbo.RequiredPlugins] PRIMARY KEY ([RequiredPluginId])
|
---|
| 52 | )
|
---|
| 53 | CREATE TABLE [dbo].[Resource](
|
---|
[7847] | 54 | [ResourceId] UniqueIdentifier NOT NULL,
|
---|
| 55 | [Name] VarChar(MAX) NOT NULL,
|
---|
| 56 | [ResourceType] NVarChar(4000) NOT NULL,
|
---|
| 57 | [ParentResourceId] UniqueIdentifier,
|
---|
| 58 | [CpuSpeed] Int,
|
---|
| 59 | [Memory] Int,
|
---|
| 60 | [Login] DateTime,
|
---|
| 61 | [SlaveState] VarChar(15),
|
---|
| 62 | [Cores] Int,
|
---|
| 63 | [FreeCores] Int,
|
---|
| 64 | [FreeMemory] Int,
|
---|
| 65 | [IsAllowedToCalculate] Bit,
|
---|
| 66 | [CpuArchitecture] VarChar(3),
|
---|
| 67 | [OperatingSystem] VarChar(MAX),
|
---|
| 68 | [LastHeartbeat] DateTime,
|
---|
| 69 | [CpuUtilization] float,
|
---|
| 70 | [HbInterval] int NOT NULL,
|
---|
[7857] | 71 | [IsDisposable] Bit,
|
---|
[7916] | 72 | [OwnerUserId] UniqueIdentifier,
|
---|
[6983] | 73 | CONSTRAINT [PK_dbo.Resource] PRIMARY KEY ([ResourceId])
|
---|
| 74 | )
|
---|
| 75 | CREATE TABLE [dbo].[Task](
|
---|
[7847] | 76 | [TaskId] UniqueIdentifier NOT NULL,
|
---|
| 77 | [TaskState] VarChar(30) NOT NULL,
|
---|
| 78 | [ExecutionTimeMs] float NOT NULL,
|
---|
| 79 | [LastHeartbeat] DateTime,
|
---|
| 80 | [ParentTaskId] UniqueIdentifier,
|
---|
| 81 | [Priority] Int NOT NULL,
|
---|
| 82 | [CoresNeeded] Int NOT NULL,
|
---|
| 83 | [MemoryNeeded] Int NOT NULL,
|
---|
| 84 | [IsParentTask] Bit NOT NULL,
|
---|
| 85 | [FinishWhenChildJobsFinished] Bit NOT NULL,
|
---|
| 86 | [Command] VarChar(30),
|
---|
| 87 | [JobId] UniqueIdentifier NOT NULL,
|
---|
[6983] | 88 | CONSTRAINT [PK_dbo.Task] PRIMARY KEY ([TaskId])
|
---|
| 89 | )
|
---|
| 90 | CREATE TABLE [dbo].[Downtime](
|
---|
[7847] | 91 | [DowntimeId] UniqueIdentifier NOT NULL,
|
---|
| 92 | [ResourceId] UniqueIdentifier NOT NULL,
|
---|
| 93 | [StartDate] DateTime NOT NULL,
|
---|
| 94 | [EndDate] DateTime NOT NULL,
|
---|
| 95 | [AllDayEvent] Bit NOT NULL,
|
---|
| 96 | [Recurring] Bit NOT NULL,
|
---|
| 97 | [RecurringId] UniqueIdentifier NOT NULL,
|
---|
[8957] | 98 | [DowntimeType] VarChar(MAX) NOT NULL,
|
---|
[6983] | 99 | CONSTRAINT [PK_dbo.Downtime] PRIMARY KEY ([DowntimeId])
|
---|
| 100 | )
|
---|
| 101 | CREATE TABLE [dbo].[Job](
|
---|
[7847] | 102 | [JobId] UniqueIdentifier NOT NULL,
|
---|
| 103 | [Name] VarChar(MAX) NOT NULL,
|
---|
| 104 | [Description] VarChar(MAX),
|
---|
| 105 | [OwnerUserId] UniqueIdentifier NOT NULL,
|
---|
| 106 | [DateCreated] DateTime NOT NULL,
|
---|
[16117] | 107 | [ProjectId] UniqueIdentifier NOT NULL,
|
---|
| 108 | [JobState] VarChar(30) NOT NULL,
|
---|
[6983] | 109 | CONSTRAINT [PK_dbo.Job] PRIMARY KEY ([JobId])
|
---|
| 110 | )
|
---|
| 111 | CREATE TABLE [dbo].[TaskData](
|
---|
[9665] | 112 | [TaskId] UniqueIdentifier RowGuidCol NOT NULL,
|
---|
| 113 | [Data] VarBinary(MAX) Filestream NOT NULL,
|
---|
[7847] | 114 | [LastUpdate] DateTime NOT NULL,
|
---|
[6983] | 115 | CONSTRAINT [PK_dbo.TaskData] PRIMARY KEY ([TaskId])
|
---|
| 116 | )
|
---|
| 117 | CREATE TABLE [dbo].[PluginData](
|
---|
[9665] | 118 | [PluginDataId] UniqueIdentifier RowGuidCol NOT NULL,
|
---|
[7847] | 119 | [PluginId] UniqueIdentifier NOT NULL,
|
---|
[9665] | 120 | [Data] VarBinary(MAX) FileStream NOT NULL,
|
---|
[7847] | 121 | [FileName] VarChar(MAX) NOT NULL,
|
---|
[6983] | 122 | CONSTRAINT [PK_dbo.PluginData] PRIMARY KEY ([PluginDataId])
|
---|
| 123 | )
|
---|
| 124 | CREATE TABLE [dbo].[StateLog](
|
---|
[7847] | 125 | [StateLogId] UniqueIdentifier NOT NULL,
|
---|
| 126 | [State] VarChar(30) NOT NULL,
|
---|
| 127 | [DateTime] DateTime NOT NULL,
|
---|
| 128 | [TaskId] UniqueIdentifier NOT NULL,
|
---|
| 129 | [UserId] UniqueIdentifier,
|
---|
| 130 | [SlaveId] UniqueIdentifier,
|
---|
| 131 | [Exception] VarChar(MAX),
|
---|
[6983] | 132 | CONSTRAINT [PK_dbo.StateLog] PRIMARY KEY ([StateLogId])
|
---|
| 133 | )
|
---|
| 134 | CREATE TABLE [dbo].[JobPermission](
|
---|
[7847] | 135 | [JobId] UniqueIdentifier NOT NULL,
|
---|
| 136 | [GrantedUserId] UniqueIdentifier NOT NULL,
|
---|
| 137 | [GrantedByUserId] UniqueIdentifier NOT NULL,
|
---|
| 138 | [Permission] VarChar(15) NOT NULL,
|
---|
[6983] | 139 | CONSTRAINT [PK_dbo.JobPermission] PRIMARY KEY ([JobId], [GrantedUserId])
|
---|
| 140 | )
|
---|
| 141 | CREATE TABLE [Lifecycle](
|
---|
[7847] | 142 | [LifecycleId] Int NOT NULL,
|
---|
| 143 | [LastCleanup] DateTime NOT NULL,
|
---|
[6983] | 144 | CONSTRAINT [PK_Lifecycle] PRIMARY KEY ([LifecycleId])
|
---|
| 145 | )
|
---|
[9123] | 146 | CREATE TABLE [UserPriority](
|
---|
| 147 | [UserId] UniqueIdentifier NOT NULL,
|
---|
| 148 | [DateEnqueued] DateTime NOT NULL,
|
---|
| 149 | CONSTRAINT [PK_UserPriority] PRIMARY KEY ([UserId])
|
---|
| 150 | )
|
---|
[16117] | 151 | CREATE TABLE [dbo].[Project](
|
---|
| 152 | [ProjectId] UniqueIdentifier NOT NULL,
|
---|
| 153 | [ParentProjectId] UniqueIdentifier,
|
---|
| 154 | [DateCreated] DateTime NOT NULL,
|
---|
| 155 | [Name] VarChar(MAX) NOT NULL,
|
---|
| 156 | [Description] VarChar(MAX),
|
---|
| 157 | [OwnerUserId] UniqueIdentifier NOT NULL,
|
---|
| 158 | [StartDate] DateTime NOT NULL,
|
---|
| 159 | [EndDate] DateTime,
|
---|
| 160 | CONSTRAINT [PK_dbo.Project] PRIMARY KEY ([ProjectId])
|
---|
| 161 | )
|
---|
| 162 | CREATE TABLE [dbo].[ProjectPermission](
|
---|
| 163 | [ProjectId] UniqueIdentifier NOT NULL,
|
---|
| 164 | [GrantedUserId] UniqueIdentifier NOT NULL,
|
---|
| 165 | [GrantedByUserId] UniqueIdentifier NOT NULL,
|
---|
| 166 | CONSTRAINT [PK_dbo.ProjectPermission] PRIMARY KEY ([ProjectId], [GrantedUserId])
|
---|
| 167 | )
|
---|
| 168 |
|
---|
| 169 | ALTER TABLE [dbo].[AssignedProjectResource]
|
---|
| 170 | ADD CONSTRAINT [Resource_AssignedProjectResource] FOREIGN KEY ([ResourceId]) REFERENCES [dbo].[Resource]([ResourceId]) ON UPDATE CASCADE ON DELETE CASCADE;
|
---|
| 171 | ALTER TABLE [dbo].[AssignedProjectResource]
|
---|
| 172 | ADD CONSTRAINT [Project_AssignedProjectResource] FOREIGN KEY ([ProjectId]) REFERENCES [dbo].[Project]([ProjectId]) ON UPDATE CASCADE ON DELETE CASCADE;
|
---|
| 173 | ALTER TABLE [dbo].[AssignedJobResource]
|
---|
| 174 | ADD CONSTRAINT [Resource_AssignedJobResource] FOREIGN KEY ([ResourceId]) REFERENCES [dbo].[Resource]([ResourceId]) ON UPDATE CASCADE ON DELETE CASCADE;
|
---|
| 175 | ALTER TABLE [dbo].[AssignedJobResource]
|
---|
| 176 | ADD CONSTRAINT [Job_AssignedJobResource] FOREIGN KEY ([JobId]) REFERENCES [dbo].[Job]([JobId]) ON UPDATE CASCADE ON DELETE CASCADE;
|
---|
[6983] | 177 | ALTER TABLE [dbo].[RequiredPlugins]
|
---|
[16117] | 178 | ADD CONSTRAINT [Plugin_RequiredPlugin] FOREIGN KEY ([PluginId]) REFERENCES [dbo].[Plugin]([PluginId]) ON UPDATE CASCADE ON DELETE CASCADE;
|
---|
[6983] | 179 | ALTER TABLE [dbo].[RequiredPlugins]
|
---|
[16117] | 180 | ADD CONSTRAINT [Task_RequiredPlugin] FOREIGN KEY ([TaskId]) REFERENCES [dbo].[Task]([TaskId]) ON UPDATE CASCADE ON DELETE CASCADE;
|
---|
[6983] | 181 | ALTER TABLE [dbo].[Resource]
|
---|
[16117] | 182 | ADD CONSTRAINT [Resource_Resource] FOREIGN KEY ([ParentResourceId]) REFERENCES [dbo].[Resource]([ResourceId]);
|
---|
[6983] | 183 | ALTER TABLE [dbo].[Task]
|
---|
[16117] | 184 | ADD CONSTRAINT [Task_Task] FOREIGN KEY ([ParentTaskId]) REFERENCES [dbo].[Task]([TaskId]);
|
---|
[6983] | 185 | ALTER TABLE [dbo].[Task]
|
---|
[16117] | 186 | ADD CONSTRAINT [Job_Task] FOREIGN KEY ([JobId]) REFERENCES [dbo].[Job]([JobId]) ON UPDATE CASCADE ON DELETE CASCADE;
|
---|
[6983] | 187 | ALTER TABLE [dbo].[Downtime]
|
---|
[16117] | 188 | ADD CONSTRAINT [Resource_Downtime] FOREIGN KEY ([ResourceId]) REFERENCES [dbo].[Resource]([ResourceId]) ON UPDATE CASCADE ON DELETE CASCADE;
|
---|
| 189 | ALTER TABLE [dbo].[Job]
|
---|
| 190 | ADD CONSTRAINT [Project_Job] FOREIGN KEY ([ProjectId]) REFERENCES [dbo].[Project]([ProjectId]);
|
---|
[6983] | 191 | ALTER TABLE [dbo].[TaskData]
|
---|
[16117] | 192 | ADD CONSTRAINT [Task_TaskData] FOREIGN KEY ([TaskId]) REFERENCES [dbo].[Task]([TaskId]) ON UPDATE CASCADE ON DELETE CASCADE;
|
---|
[6983] | 193 | ALTER TABLE [dbo].[PluginData]
|
---|
[16117] | 194 | ADD CONSTRAINT [Plugin_PluginData] FOREIGN KEY ([PluginId]) REFERENCES [dbo].[Plugin]([PluginId]) ON UPDATE CASCADE ON DELETE CASCADE;
|
---|
[6983] | 195 | ALTER TABLE [dbo].[StateLog]
|
---|
[16117] | 196 | ADD CONSTRAINT [Task_StateLog] FOREIGN KEY ([TaskId]) REFERENCES [dbo].[Task]([TaskId]) ON UPDATE CASCADE ON DELETE CASCADE;
|
---|
[6983] | 197 | ALTER TABLE [dbo].[StateLog]
|
---|
[16117] | 198 | ADD CONSTRAINT [Resource_StateLog] FOREIGN KEY ([SlaveId]) REFERENCES [dbo].[Resource]([ResourceId]) ON UPDATE CASCADE ON DELETE CASCADE;
|
---|
[6983] | 199 | ALTER TABLE [dbo].[JobPermission]
|
---|
[16117] | 200 | ADD CONSTRAINT [Job_JobPermission] FOREIGN KEY ([JobId]) REFERENCES [dbo].[Job]([JobId]) ON UPDATE CASCADE ON DELETE CASCADE;
|
---|
| 201 | ALTER TABLE [dbo].[Project]
|
---|
| 202 | ADD CONSTRAINT [Project_Project] FOREIGN KEY ([ParentProjectId]) REFERENCES [dbo].[Project]([ProjectId]);
|
---|
| 203 | ALTER TABLE [dbo].[ProjectPermission]
|
---|
| 204 | ADD CONSTRAINT [Project_ProjectPermission] FOREIGN KEY ([ProjectId]) REFERENCES [dbo].[Project]([ProjectId]) ON UPDATE CASCADE ON DELETE CASCADE;
|
---|
[12878] | 205 |
|
---|
| 206 | GO
|
---|
| 207 | CREATE SCHEMA [statistics]
|
---|
| 208 | GO
|
---|
| 209 |
|
---|
| 210 | CREATE TABLE [statistics].[DimTime] (
|
---|
| 211 | [Time] DATETIME NOT NULL,
|
---|
| 212 | [Minute] DATETIME NOT NULL,
|
---|
| 213 | [Hour] DATETIME NOT NULL,
|
---|
| 214 | [Day] DATE NOT NULL,
|
---|
| 215 | [Month] DATE NOT NULL,
|
---|
| 216 | [Year] DATE NOT NULL,
|
---|
| 217 | CONSTRAINT [PK_DimTime] PRIMARY KEY CLUSTERED ([Time] ASC)
|
---|
| 218 | );
|
---|
| 219 | CREATE TABLE [statistics].[DimClient] (
|
---|
| 220 | [Id] UNIQUEIDENTIFIER CONSTRAINT [DF_DimClient_Id] DEFAULT (newsequentialid()) NOT NULL,
|
---|
| 221 | [ResourceId] UNIQUEIDENTIFIER NOT NULL,
|
---|
[16117] | 222 | [ParentResourceId] UNIQUEIDENTIFIER NULL,
|
---|
| 223 | [Name] VARCHAR (MAX) NOT NULL,
|
---|
| 224 | [ResourceType] VARCHAR (MAX) NULL,
|
---|
| 225 | [DateCreated] DATETIME NOT NULL,
|
---|
| 226 | [DateExpired] DATETIME NULL
|
---|
[12878] | 227 | CONSTRAINT [PK_DimClient] PRIMARY KEY CLUSTERED ([Id] ASC)
|
---|
| 228 | );
|
---|
| 229 | CREATE TABLE [statistics].[DimJob] (
|
---|
| 230 | [JobId] UNIQUEIDENTIFIER NOT NULL,
|
---|
| 231 | [UserId] UNIQUEIDENTIFIER NOT NULL,
|
---|
[16117] | 232 | [ProjectId] UNIQUEIDENTIFIER NOT NULL,
|
---|
[12878] | 233 | [JobName] VARCHAR (MAX) NOT NULL,
|
---|
| 234 | [UserName] VARCHAR (MAX) NOT NULL,
|
---|
| 235 | [DateCreated] DATETIME NOT NULL,
|
---|
| 236 | [TotalTasks] INT NOT NULL,
|
---|
| 237 | [CompletedTasks] INT NOT NULL,
|
---|
| 238 | [DateCompleted] DATETIME NULL,
|
---|
| 239 | CONSTRAINT [PK_DimJob] PRIMARY KEY CLUSTERED ([JobId] ASC)
|
---|
| 240 | );
|
---|
[16117] | 241 | CREATE TABLE [statistics].[DimProject] (
|
---|
| 242 | [Id] UNIQUEIDENTIFIER CONSTRAINT [DF_DimProject_Id] DEFAULT (newsequentialid()) NOT NULL,
|
---|
| 243 | [ProjectId] UNIQUEIDENTIFIER NOT NULL,
|
---|
| 244 | [ParentProjectId] UNIQUEIDENTIFIER NULL,
|
---|
| 245 | [Name] VARCHAR (MAX) NOT NULL,
|
---|
| 246 | [Description] VARCHAR (MAX) NULL,
|
---|
| 247 | [OwnerUserId] UNIQUEIDENTIFIER NOT NULL,
|
---|
| 248 | [StartDate] DATETIME NOT NULL,
|
---|
| 249 | [EndDate] DATETIME NULL,
|
---|
| 250 | [DateCreated] DATETIME NOT NULL,
|
---|
| 251 | [DateExpired] DATETIME NULL
|
---|
| 252 | CONSTRAINT [PK_DimProject] PRIMARY KEY CLUSTERED ([Id] ASC)
|
---|
| 253 | );
|
---|
[12878] | 254 | CREATE TABLE [statistics].[DimUser] (
|
---|
| 255 | [UserId] UNIQUEIDENTIFIER NOT NULL,
|
---|
| 256 | [Name] VARCHAR (MAX) NOT NULL,
|
---|
| 257 | CONSTRAINT [PK_DimUser] PRIMARY KEY CLUSTERED ([UserId] ASC)
|
---|
| 258 | );
|
---|
[16117] | 259 |
|
---|
| 260 |
|
---|
| 261 |
|
---|
| 262 | CREATE TABLE [statistics].[FactProjectInfo] (
|
---|
| 263 | [ProjectId] UNIQUEIDENTIFIER NOT NULL,
|
---|
| 264 | [Time] DATETIME NOT NULL,
|
---|
| 265 | [NumTotalCores] INT NOT NULL,
|
---|
| 266 | [NumUsedCores] INT NOT NULL,
|
---|
| 267 | [TotalMemory] INT NOT NULL,
|
---|
| 268 | [UsedMemory] INT NOT NULL
|
---|
| 269 | CONSTRAINT [PK_FactProjectInfo] PRIMARY KEY CLUSTERED ([ProjectId] ASC, [Time] ASC),
|
---|
| 270 | CONSTRAINT [FK_FactProjectInfo_DimTime] FOREIGN KEY ([Time]) REFERENCES [statistics].[DimTime] ([Time]),
|
---|
| 271 | CONSTRAINT [FK_FactProjectInfo_DimProject] FOREIGN KEY ([ProjectId]) REFERENCES [statistics].[DimProject] ([Id])
|
---|
| 272 | );
|
---|
[12878] | 273 | CREATE TABLE [statistics].[FactClientInfo] (
|
---|
| 274 | [ClientId] UNIQUEIDENTIFIER NOT NULL,
|
---|
| 275 | [Time] DATETIME NOT NULL,
|
---|
| 276 | [UserId] UNIQUEIDENTIFIER NOT NULL,
|
---|
| 277 | [NumUsedCores] INT NOT NULL,
|
---|
| 278 | [NumTotalCores] INT NOT NULL,
|
---|
| 279 | [UsedMemory] INT NOT NULL,
|
---|
| 280 | [TotalMemory] INT NOT NULL,
|
---|
| 281 | [CpuUtilization] FLOAT (53) NOT NULL,
|
---|
| 282 | [SlaveState] VarChar(15) NOT NULL,
|
---|
| 283 | [IdleTime] INT NOT NULL,
|
---|
| 284 | [OfflineTime] INT NOT NULL,
|
---|
| 285 | [UnavailableTime] INT NOT NULL,
|
---|
| 286 | [IsAllowedToCalculate] BIT NOT NULL,
|
---|
| 287 | CONSTRAINT [PK_FactClientInfo] PRIMARY KEY CLUSTERED ([ClientId] ASC, [Time] ASC, [UserId] ASC),
|
---|
| 288 | CONSTRAINT [FK_FactClientInfo_DimTime] FOREIGN KEY ([Time]) REFERENCES [statistics].[DimTime] ([Time]),
|
---|
| 289 | CONSTRAINT [FK_FactClientInfo_DimClient] FOREIGN KEY ([ClientId]) REFERENCES [statistics].[DimClient] ([Id]),
|
---|
| 290 | CONSTRAINT [FK_FactClientInfo_DimUser] FOREIGN KEY ([UserId]) REFERENCES [statistics].[DimUser] ([UserId])
|
---|
| 291 | );
|
---|
| 292 | CREATE TABLE [statistics].[FactTask] (
|
---|
| 293 | [TaskId] UNIQUEIDENTIFIER NOT NULL,
|
---|
| 294 | [CalculatingTime] INT NOT NULL,
|
---|
| 295 | [WaitingTime] INT NOT NULL,
|
---|
| 296 | [TransferTime] INT NOT NULL,
|
---|
| 297 | [NumCalculationRuns] INT NOT NULL,
|
---|
| 298 | [NumRetries] INT NOT NULL,
|
---|
| 299 | [CoresRequired] INT NOT NULL,
|
---|
| 300 | [MemoryRequired] INT NOT NULL,
|
---|
| 301 | [Priority] INT NOT NULL,
|
---|
| 302 | [LastClientId] UNIQUEIDENTIFIER NULL,
|
---|
| 303 | [JobId] UNIQUEIDENTIFIER NOT NULL,
|
---|
| 304 | [StartTime] DATETIME NULL,
|
---|
| 305 | [EndTime] DATETIME NULL,
|
---|
| 306 | [TaskState] VARCHAR (30) NOT NULL,
|
---|
| 307 | [Exception] VARCHAR (MAX) NULL,
|
---|
| 308 | [InitialWaitingTime] INT NULL,
|
---|
| 309 | CONSTRAINT [PK_FactTask] PRIMARY KEY CLUSTERED ([TaskId] ASC),
|
---|
| 310 | CONSTRAINT [FK_FactTask_DimClient] FOREIGN KEY ([LastClientId]) REFERENCES [statistics].[DimClient] ([Id]),
|
---|
| 311 | CONSTRAINT [FK_FactTask_DimJob] FOREIGN KEY ([JobId]) REFERENCES [statistics].[DimJob] ([JobId])
|
---|
| 312 | );
|
---|
| 313 |
|
---|
| 314 | /* dummy for nullable userIds in FactClientInfo */
|
---|
| 315 | INSERT INTO [statistics].[DimUser] ([UserId], [Name])
|
---|
[13678] | 316 | VALUES ('00000000-0000-0000-0000-000000000000', 'NULL');
|
---|
| 317 |
|
---|
| 318 | /****** Object: Index [TaskIdStateLog] Script Date: 03/10/2016 10:09:14 ******/
|
---|
| 319 | CREATE NONCLUSTERED INDEX [TaskIdStateLog] ON [dbo].[StateLog]
|
---|
| 320 | (
|
---|
| 321 | [TaskId] ASC
|
---|
| 322 | )
|
---|
| 323 | INCLUDE ( [StateLogId],
|
---|
| 324 | [State],
|
---|
| 325 | [DateTime],
|
---|
| 326 | [UserId],
|
---|
| 327 | [SlaveId],
|
---|
| 328 | [Exception]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
---|
| 329 | GO
|
---|
| 330 |
|
---|
| 331 | /****** Object: Index [Index_RequiredPlugins_TaskId] Script Date: 03/10/2016 10:09:19 ******/
|
---|
| 332 | CREATE NONCLUSTERED INDEX [Index_RequiredPlugins_TaskId] ON [dbo].[RequiredPlugins]
|
---|
| 333 | (
|
---|
| 334 | [TaskId] ASC
|
---|
| 335 | )
|
---|
| 336 | INCLUDE ( [RequiredPluginId],
|
---|
| 337 | [PluginId]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
---|
| 338 | GO
|
---|
| 339 |
|
---|
| 340 |
|
---|