Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/08/11 14:37:52 (13 years ago)
Author:
ascheibe
Message:

#1233 Review comments: renamed HiveEperiment to Job

Location:
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.3/SQL Scripts
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.3/SQL Scripts/Initialize Hive Database.sql

    r6721 r6723  
    44SET ARITHABORT ON
    55CREATE TABLE [dbo].[AssignedResources](
    6   [ResourceId] UniqueIdentifier NOT NULL, 
     6  [ResourceId] UniqueIdentifier NOT NULL,
    77  [TaskId] UniqueIdentifier NOT NULL,   
    88  CONSTRAINT [PK_dbo.ResourceIdTaskId] PRIMARY KEY ([ResourceId], [TaskId])
     
    5454  [FinishWhenChildJobsFinished] Bit,
    5555  [Command] VarChar(30),
    56   [HiveExperimentId] UniqueIdentifier NOT NULL,
     56  [JobId] UniqueIdentifier NOT NULL,
    5757  [IsPrivileged] Bit,
    5858  CONSTRAINT [PK_dbo.Task] PRIMARY KEY ([TaskId])
     
    6868  CONSTRAINT [PK_dbo.Downtime] PRIMARY KEY ([DowntimeId])
    6969  )
    70 CREATE TABLE [dbo].[HiveExperiment](
    71   [HiveExperimentId] UniqueIdentifier NOT NULL,
     70CREATE TABLE [dbo].[Job](
     71  [JobId] UniqueIdentifier NOT NULL,
    7272  [Name] VarChar(MAX),
    7373  [Description] VarChar(MAX),
     
    7777  [LastAccessed] DateTime,
    7878  [IsHiveEngine] Bit,
    79   CONSTRAINT [PK_dbo.HiveExperiment] PRIMARY KEY ([HiveExperimentId])
     79  CONSTRAINT [PK_dbo.Job] PRIMARY KEY ([JobId])
    8080  )
    8181CREATE TABLE [dbo].[TaskData](
     
    102102  CONSTRAINT [PK_dbo.StateLog] PRIMARY KEY ([StateLogId])
    103103  )
    104 CREATE TABLE [dbo].[HiveExperimentPermission](
    105   [HiveExperimentId] UniqueIdentifier NOT NULL,
     104CREATE TABLE [dbo].[JobPermission](
     105  [JobId] UniqueIdentifier NOT NULL,
    106106  [GrantedUserId] UniqueIdentifier NOT NULL,
    107107  [GrantedByUserId] UniqueIdentifier NOT NULL,
    108108  [Permission] VarChar(15) NOT NULL,
    109   CONSTRAINT [PK_dbo.HiveExperimentPermission] PRIMARY KEY ([HiveExperimentId], [GrantedUserId])
     109  CONSTRAINT [PK_dbo.JobPermission] PRIMARY KEY ([JobId], [GrantedUserId])
    110110  )
    111111CREATE TABLE [Lifecycle](
     
    159159  ADD CONSTRAINT [Task_Task] FOREIGN KEY ([ParentTaskId]) REFERENCES [dbo].[Task]([TaskId])
    160160ALTER TABLE [dbo].[Task]
    161   ADD CONSTRAINT [HiveExperiment_Job] FOREIGN KEY ([HiveExperimentId]) REFERENCES [dbo].[HiveExperiment]([HiveExperimentId])
     161  ADD CONSTRAINT [Job_Job] FOREIGN KEY ([JobId]) REFERENCES [dbo].[Job]([JobId])
    162162ALTER TABLE [dbo].[Downtime]
    163163  ADD CONSTRAINT [Resource_Downtime] FOREIGN KEY ([ResourceId]) REFERENCES [dbo].[Resource]([ResourceId])
     
    170170ALTER TABLE [dbo].[StateLog]
    171171  ADD CONSTRAINT [Resource_StateLog] FOREIGN KEY ([SlaveId]) REFERENCES [dbo].[Resource]([ResourceId])
    172 ALTER TABLE [dbo].[HiveExperimentPermission]
    173   ADD CONSTRAINT [HiveExperiment_HiveExperimentPermission] FOREIGN KEY ([HiveExperimentId]) REFERENCES [dbo].[HiveExperiment]([HiveExperimentId])
     172ALTER TABLE [dbo].[JobPermission]
     173  ADD CONSTRAINT [Job_JobPermission] FOREIGN KEY ([JobId]) REFERENCES [dbo].[Job]([JobId])
    174174ALTER TABLE [UserStatistics]
    175175  ADD CONSTRAINT [Statistics_UserStatistics] FOREIGN KEY ([StatisticsId]) REFERENCES [Statistics]([StatisticsId])
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.3/SQL Scripts/Prepare Hive Database.sql

    r6721 r6723  
    7474ALTER TABLE dbo.Downtime WITH NOCHECK ADD CONSTRAINT [DF_Downtime_DowntimeId] DEFAULT (NEWSEQUENTIALID()) FOR DowntimeId;
    7575
    76 ALTER TABLE dbo.HiveExperiment ALTER COLUMN HiveExperimentId ADD ROWGUIDCOL;
    77 ALTER TABLE dbo.HiveExperiment WITH NOCHECK ADD CONSTRAINT [DF_HiveExperiment_HiveExperimentId] DEFAULT (NEWSEQUENTIALID()) FOR HiveExperimentId;
     76ALTER TABLE dbo.Job ALTER COLUMN JobId ADD ROWGUIDCOL;
     77ALTER TABLE dbo.Job WITH NOCHECK ADD CONSTRAINT [DF_Job_JobId] DEFAULT (NEWSEQUENTIALID()) FOR JobId;
    7878
    7979ALTER TABLE dbo.StateLog ALTER COLUMN StateLogId ADD ROWGUIDCOL;
    8080ALTER TABLE dbo.StateLog WITH NOCHECK ADD CONSTRAINT [DF_StateLog_StateLogId] DEFAULT (NEWSEQUENTIALID()) FOR StateLogId;
    8181
    82 ALTER TABLE [dbo].[HiveExperimentPermission]  DROP  CONSTRAINT [HiveExperiment_HiveExperimentPermission]
    83 ALTER TABLE [dbo].[HiveExperimentPermission]  WITH CHECK ADD CONSTRAINT [HiveExperiment_HiveExperimentPermission] FOREIGN KEY([HiveExperimentId])
    84 REFERENCES [dbo].[HiveExperiment] ([HiveExperimentId])
     82ALTER TABLE [dbo].[JobPermission]  DROP  CONSTRAINT [Job_JobPermission]
     83ALTER TABLE [dbo].[JobPermission]  WITH CHECK ADD CONSTRAINT [Job_JobPermission] FOREIGN KEY([JobId])
     84REFERENCES [dbo].[Job] ([JobId])
    8585ON UPDATE CASCADE
    8686ON DELETE CASCADE
     
    161161/* triggers */
    162162GO
    163 /****** Object:  Trigger [dbo].[tr_HiveExperimentDeleteCascade]    Script Date: 04/19/2011 16:31:53 ******/
     163/****** Object:  Trigger [dbo].[tr_JobDeleteCascade]    Script Date: 04/19/2011 16:31:53 ******/
    164164SET ANSI_NULLS ON
    165165GO
     
    174174--              is not compatible with cascading deletes.
    175175-- =============================================
    176 CREATE TRIGGER [dbo].[tr_HiveExperimentDeleteCascade] ON [dbo].[HiveExperiment] INSTEAD OF DELETE AS
     176CREATE TRIGGER [dbo].[tr_JobDeleteCascade] ON [dbo].[Job] INSTEAD OF DELETE AS
    177177BEGIN
    178   DELETE Task FROM deleted, Task WHERE deleted.HiveExperimentId = Task.HiveExperimentId
    179   DELETE HiveExperiment FROM deleted, HiveExperiment WHERE deleted.HiveExperimentId = HiveExperiment.HiveExperimentId
     178  DELETE Task FROM deleted, Task WHERE deleted.JobId = Task.JobId
     179  DELETE Job FROM deleted, Job WHERE deleted.JobId = Job.JobId
    180180END
    181181GO
     
    186186-- Description: Recursively deletes all child-jobs of a job when it is deleted. (Source: http://devio.wordpress.com/2008/05/23/recursive-delete-in-sql-server/)
    187187-- =============================================
    188 CREATE TRIGGER [dbo].[tr_JobDeleteCascade] ON [dbo].[Task] INSTEAD OF DELETE AS
     188CREATE TRIGGER [dbo].[tr_TaskDeleteCascade] ON [dbo].[Task] INSTEAD OF DELETE AS
    189189BEGIN
    190190  -- add statistics
     
    197197  FROM
    198198    deleted j,
    199     HiveExperiment he,
     199    Job he,
    200200    view_FirstState fs,
    201201    view_LastState ls
    202202  WHERE
    203     he.HiveExperimentId = j.HiveExperimentId AND
     203    he.JobId = j.JobId AND
    204204    fs.TaskId = j.TaskId AND
    205205    ls.TaskId = j.TaskId
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.3/SQL Scripts/Query Jobs.sql

    r6721 r6723  
    1616      ,j.[FinishWhenChildJobsFinished]
    1717      ,j.[ParentTaskId]
    18       , he.HiveExperimentId
     18      , he.JobId
    1919  FROM
    2020  [HeuristicLab.Hive-3.3].[dbo].[Task] j
    21   ,[HeuristicLab.Hive-3.3].[dbo].[HiveExperiment] he
     21  ,[HeuristicLab.Hive-3.3].[dbo].[Job] he
    2222  ,[HeuristicLab.Authentication].dbo.aspnet_Users u
    2323  ,[HeuristicLab.Hive-3.3].dbo.TaskData jd
    2424  WHERE
    25   j.HiveExperimentId = he.HiveExperimentId
     25  j.JobId = he.JobId
    2626  AND j.TaskId = jd.TaskId
    2727  AND he.OwnerUserId = u.UserId
Note: See TracChangeset for help on using the changeset viewer.