Free cookie consent management tool by TermsFeed Policy Generator

Changeset 15378


Ignore:
Timestamp:
09/25/17 14:45:14 (7 years ago)
Author:
jkarder
Message:

#2839: worked on database model

Location:
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.dbml

    r14748 r15378  
    11<?xml version="1.0" encoding="utf-8"?><Database Name="HeuristicLab.Hive" Class="HiveDataContext" xmlns="http://schemas.microsoft.com/linqtosql/dbml/2007">
    2   <Connection Mode="AppSettings" ConnectionString="Data Source=.\SQLEXPRESS;Integrated Security=SSPI;Initial Catalog=HeuristicLab.Hive-3.3" SettingsObjectName="HeuristicLab.Services.Hive.DataAccess.Settings" SettingsPropertyName="HeuristicLab_Hive_LinqConnectionString" Provider="System.Data.SqlClient" />
    3   <Table Name="dbo.AssignedResources" Member="AssignedResources">
     2  <Table Name="dbo.AssignedResource" Member="AssignedResources">
    43    <Type Name="AssignedResource">
    54      <Column Name="ResourceId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
    6       <Column Name="TaskId" Storage="_JobId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
     5      <Column Name="ProjectId" Storage="_JobId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
    76      <Association Name="Resource_AssignedResource" Member="Resource" ThisKey="ResourceId" OtherKey="ResourceId" Type="Resource" IsForeignKey="true" DeleteRule="CASCADE" />
    8       <Association Name="Task_AssignedResource" Member="Task" Storage="_Job" ThisKey="TaskId" OtherKey="TaskId" Type="Task" IsForeignKey="true" DeleteRule="CASCADE" />
     7      <Association Name="Project_AssignedResource" Member="Project" ThisKey="ProjectId" OtherKey="ProjectId" Type="Project" IsForeignKey="true" DeleteRule="CASCADE" />
    98    </Type>
    109  </Table>
     
    7675      <Column Name="Command" Type="global::HeuristicLab.Services.Hive.DataAccess.Command?" DbType="VarChar(30)" CanBeNull="true" />
    7776      <Column Name="JobId" Storage="_HiveExperimentId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" CanBeNull="false" />
    78       <Association Name="Task_AssignedResource" Member="AssignedResources" ThisKey="TaskId" OtherKey="TaskId" Type="AssignedResource" />
    7977      <Association Name="Task_RequiredPlugin" Member="RequiredPlugins" ThisKey="TaskId" OtherKey="TaskId" Type="RequiredPlugin" />
    8078      <Association Name="Task_Task" Member="ChildJobs" Storage="_Jobs" ThisKey="TaskId" OtherKey="ParentTaskId" Type="Task" />
     
    106104      <Column Name="OwnerUserId" Storage="_UserId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="false" />
    107105      <Column Name="DateCreated" Type="System.DateTime" DbType="DateTime" CanBeNull="false" />
     106      <Column Name="ProjectId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" CanBeNull="false" />
    108107      <Association Name="Job_Task" Member="Tasks" Storage="_Jobs" ThisKey="JobId" OtherKey="JobId" Type="Task" />
    109108      <Association Name="Job_JobPermission" Member="JobPermissions" Storage="_HiveExperimentPermissions" ThisKey="JobId" OtherKey="JobId" Type="JobPermission" />
     109      <Association Name="Project_Job" Member="Project" ThisKey="ProjectId" OtherKey="ProjectId" Type="Project" IsForeignKey="true" />
    110110    </Type>
    111111  </Table>
     
    240240      <Column Name="ClientId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
    241241      <Column Name="Time" Type="System.DateTime" DbType="DateTime NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
    242       <Column Name="UserId" Type="System.Guid" DbType="UniqueIdentifier NULL" IsPrimaryKey="true" CanBeNull="false" />
     242      <Column Name="UserId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
    243243      <Column Name="NumUsedCores" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
    244244      <Column Name="NumTotalCores" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
     
    256256    </Type>
    257257  </Table>
     258  <Table Name="dbo.Project" Member="Projects">
     259    <Type Name="Project">
     260      <Column Name="ProjectId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
     261      <Column Name="ParentProjectId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="true" />
     262      <Column Name="DateCreated" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />
     263      <Column Name="Name" Type="System.String" DbType="VarChar(MAX)" CanBeNull="false" />
     264      <Column Name="Description" Type="System.String" DbType="VarChar(MAX)" CanBeNull="false" />
     265      <Column Name="OwnerUserId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" CanBeNull="false" />
     266      <Column Name="StartDate" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />
     267      <Column Name="EndDate" Type="System.DateTime" DbType="DateTime" CanBeNull="false" />
     268      <Association Name="Project_AssignedResource" Member="AssignedResources" ThisKey="ProjectId" OtherKey="ProjectId" Type="AssignedResource" />
     269      <Association Name="Project_Job" Member="Jobs" ThisKey="ProjectId" OtherKey="ProjectId" Type="Job" />
     270      <Association Name="Project_Project" Member="ChildProjects" Storage="_Projects" ThisKey="ProjectId" OtherKey="ParentProjectId" Type="Project" />
     271      <Association Name="Project_ProjectPermission" Member="ProjectPermissions" ThisKey="ProjectId" OtherKey="ProjectId" Type="ProjectPermission" />
     272      <Association Name="Project_Project" Member="ParentProject" Storage="_Project1" ThisKey="ParentProjectId" OtherKey="ProjectId" Type="Project" IsForeignKey="true" />
     273    </Type>
     274  </Table>
     275  <Table Name="dbo.ProjectPermission" Member="ProjectPermissions">
     276    <Type Name="ProjectPermission">
     277      <Column Name="ProjectId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
     278      <Column Name="GrantedUserId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
     279      <Column Name="GrantedByUserId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" CanBeNull="false" />
     280      <Association Name="Project_ProjectPermission" Member="Project" ThisKey="ProjectId" OtherKey="ProjectId" Type="Project" IsForeignKey="true" />
     281    </Type>
     282  </Table>
    258283</Database>
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.dbml.layout

    r12926 r15378  
    11<?xml version="1.0" encoding="utf-8"?>
    2 <ordesignerObjectsDiagram dslVersion="1.0.0.0" absoluteBounds="0, 0, 15.75, 17.875" name="HiveDataContext">
     2<ordesignerObjectsDiagram dslVersion="1.0.0.0" absoluteBounds="0, 0, 16.25, 17.875" name="HiveDataContext">
    33  <DataContextMoniker Name="/HiveDataContext" />
    44  <nestedChildShapes>
    5     <classShape Id="a929c9dc-69f4-4488-ba1c-a2342bf81d89" absoluteBounds="8.875, 4.5, 2, 1.1939925130208327">
     5    <classShape Id="a929c9dc-69f4-4488-ba1c-a2342bf81d89" absoluteBounds="13.875, 8.25, 2, 1.1939925130208327">
    66      <DataClassMoniker Name="/HiveDataContext/AssignedResource" />
    77      <nestedChildShapes>
    8         <elementListCompartment Id="8b005775-f0ee-41b0-ae10-6d1151003708" absoluteBounds="8.89, 4.9600000000000009, 1.9700000000000002, 0.63399251302083326" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     8        <elementListCompartment Id="8b005775-f0ee-41b0-ae10-6d1151003708" absoluteBounds="13.89, 8.71, 1.9700000000000002, 0.63399251302083326" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
    99      </nestedChildShapes>
    1010    </classShape>
     
    3939      </nestedChildShapes>
    4040    </classShape>
    41     <classShape Id="e6f840cc-2968-4be1-b234-eef624ccacbb" absoluteBounds="4.125, 2.625, 2, 1.9631982421874996">
     41    <classShape Id="e6f840cc-2968-4be1-b234-eef624ccacbb" absoluteBounds="4.125, 2.625, 2, 2.1554996744791666">
    4242      <DataClassMoniker Name="/HiveDataContext/Job" />
    4343      <nestedChildShapes>
    44         <elementListCompartment Id="0c65d4e1-256a-4a91-9a57-392f25e4de7f" absoluteBounds="4.1400000000000006, 3.0850000000000009, 1.9700000000000002, 1.4031982421875" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     44        <elementListCompartment Id="0c65d4e1-256a-4a91-9a57-392f25e4de7f" absoluteBounds="4.1400000000000006, 3.0850000000000009, 1.9700000000000002, 1.5954996744791665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
    4545      </nestedChildShapes>
    4646    </classShape>
     
    6969      </nodes>
    7070    </inheritanceConnector>
    71     <associationConnector edgePoints="[(11.8134963640734 : 2.9631982421875); (11.8134963640734 : 3.56770833333333); (11.1119791666667 : 3.56770833333333); (11.1119791666667 : 5.09699625651042); (10.875 : 5.09699625651042)]" manuallyRouted="true" fixedFrom="NotFixed" fixedTo="NotFixed">
     71    <associationConnector edgePoints="[(13.25 : 2.15469482421875); (15.71875 : 2.15469482421875); (15.71875 : 8.25)]" manuallyRouted="true" fixedFrom="NotFixed" fixedTo="NotFixed">
    7272      <AssociationMoniker Name="/HiveDataContext/Resource/Resource_AssignedResource" />
    7373      <nodes>
     
    141141      </nodes>
    142142    </associationConnector>
    143     <associationConnector edgePoints="[(8.5 : 4.1170068359375); (8.875 : 4.5)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    144       <AssociationMoniker Name="/HiveDataContext/Task/Task_AssignedResource" />
    145       <nodes>
    146         <classShapeMoniker Id="695bfc39-59f3-4e60-8644-f847964bf62c" />
    147         <classShapeMoniker Id="a929c9dc-69f4-4488-ba1c-a2342bf81d89" />
    148       </nodes>
    149     </associationConnector>
    150143    <associationConnector edgePoints="[(7.4687475 : 4.1170068359375); (7.4687475 : 5.875)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    151144      <AssociationMoniker Name="/HiveDataContext/Task/Task_RequiredPlugin" />
     
    183176      </nodes>
    184177    </associationConnector>
    185     <associationConnector edgePoints="[(4.125 : 4.10659912109375); (3.75 : 4.10659912109375)]" fixedFrom="NotFixed" fixedTo="NotFixed">
     178    <associationConnector edgePoints="[(4.125 : 4.20274983723958); (3.75 : 4.20274983723958)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    186179      <AssociationMoniker Name="/HiveDataContext/Job/Job_JobPermission" />
    187180      <nodes>
     
    280273      </nodes>
    281274    </associationConnector>
     275    <classShape Id="30778876-b5f6-4a97-9ec7-792011973d75" absoluteBounds="11.25, 8.25, 2, 2.3478011067708344">
     276      <DataClassMoniker Name="/HiveDataContext/Project" />
     277      <nestedChildShapes>
     278        <elementListCompartment Id="2c8b0555-6cea-4cc9-b028-2d066c02401c" absoluteBounds="11.265, 8.71, 1.9700000000000002, 1.7878011067708333" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     279      </nestedChildShapes>
     280    </classShape>
     281    <associationConnector edgePoints="[(11.9592307692308 : 10.5978011067708); (11.9592307692308 : 10.8478011067708); (12.5546153846154 : 10.8478011067708); (12.5546153846154 : 10.5978011067708)]" fixedFrom="NotFixed" fixedTo="NotFixed">
     282      <AssociationMoniker Name="/HiveDataContext/Project/Project_Project" />
     283      <nodes>
     284        <classShapeMoniker Id="30778876-b5f6-4a97-9ec7-792011973d75" />
     285        <classShapeMoniker Id="30778876-b5f6-4a97-9ec7-792011973d75" />
     286      </nodes>
     287    </associationConnector>
     288    <classShape Id="1c20ff2a-adeb-4830-9456-9a2a3e11cee3" absoluteBounds="13.875, 9.875, 2, 1.3862939453125005">
     289      <DataClassMoniker Name="/HiveDataContext/ProjectPermission" />
     290      <nestedChildShapes>
     291        <elementListCompartment Id="d115744c-dfef-4a5d-9b9a-30efc6ef4423" absoluteBounds="13.89, 10.335, 1.9700000000000002, 0.8262939453125" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     292      </nestedChildShapes>
     293    </classShape>
     294    <associationConnector edgePoints="[(13.25 : 10.2364005533854); (13.875 : 10.2364005533854)]" fixedFrom="NotFixed" fixedTo="NotFixed">
     295      <AssociationMoniker Name="/HiveDataContext/Project/Project_ProjectPermission" />
     296      <nodes>
     297        <classShapeMoniker Id="30778876-b5f6-4a97-9ec7-792011973d75" />
     298        <classShapeMoniker Id="1c20ff2a-adeb-4830-9456-9a2a3e11cee3" />
     299      </nodes>
     300    </associationConnector>
     301    <associationConnector edgePoints="[(13.25 : 8.84699625651042); (13.875 : 8.84699625651042)]" fixedFrom="NotFixed" fixedTo="NotFixed">
     302      <AssociationMoniker Name="/HiveDataContext/Project/Project_AssignedResource" />
     303      <nodes>
     304        <classShapeMoniker Id="30778876-b5f6-4a97-9ec7-792011973d75" />
     305        <classShapeMoniker Id="a929c9dc-69f4-4488-ba1c-a2342bf81d89" />
     306      </nodes>
     307    </associationConnector>
     308    <associationConnector edgePoints="[(11.25 : 9.42390055338542); (10.375 : 9.42390055338542); (10.375 : 8); (4 : 8); (4 : 5.15549967447917); (5.125 : 5.15549967447917); (5.125 : 4.78049967447917)]" fixedFrom="NotFixed" fixedTo="NotFixed">
     309      <AssociationMoniker Name="/HiveDataContext/Project/Project_Job" />
     310      <nodes>
     311        <classShapeMoniker Id="30778876-b5f6-4a97-9ec7-792011973d75" />
     312        <classShapeMoniker Id="e6f840cc-2968-4be1-b234-eef624ccacbb" />
     313      </nodes>
     314    </associationConnector>
    282315  </nestedChildShapes>
    283316</ordesignerObjectsDiagram>
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.designer.cs

    r12926 r15378  
    33// <auto-generated>
    44//     This code was generated by a tool.
    5 //     Runtime Version:4.0.30319.34209
     5//     Runtime Version:4.0.30319.42000
    66//
    77//     Changes to this file may cause incorrect behavior and will be lost if
     
    9191    partial void UpdateFactClientInfo(FactClientInfo instance);
    9292    partial void DeleteFactClientInfo(FactClientInfo instance);
     93    partial void InsertProject(Project instance);
     94    partial void UpdateProject(Project instance);
     95    partial void DeleteProject(Project instance);
     96    partial void InsertProjectPermission(ProjectPermission instance);
     97    partial void UpdateProjectPermission(ProjectPermission instance);
     98    partial void DeleteProjectPermission(ProjectPermission instance);
    9399    #endregion
    94    
    95     public HiveDataContext() :
    96         base(global::HeuristicLab.Services.Hive.DataAccess.Settings.Default.HeuristicLab_Hive_LinqConnectionString, mappingSource)
    97     {
    98       OnCreated();
    99     }
    100100   
    101101    public HiveDataContext(string connection) :
     
    282282      }
    283283    }
     284   
     285    public System.Data.Linq.Table<Project> Projects
     286    {
     287      get
     288      {
     289        return this.GetTable<Project>();
     290      }
     291    }
     292   
     293    public System.Data.Linq.Table<ProjectPermission> ProjectPermissions
     294    {
     295      get
     296      {
     297        return this.GetTable<ProjectPermission>();
     298      }
     299    }
    284300  }
    285301 
    286   [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.AssignedResources")]
     302  [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.AssignedResource")]
    287303  public partial class AssignedResource : INotifyPropertyChanging, INotifyPropertyChanged
    288304  {
     
    296312    private EntityRef<Resource> _Resource;
    297313   
    298     private EntityRef<Task> _Job;
     314    private EntityRef<Project> _Project;
    299315   
    300316    #region Extensibility Method Definitions
     
    304320    partial void OnResourceIdChanging(System.Guid value);
    305321    partial void OnResourceIdChanged();
    306     partial void OnTaskIdChanging(System.Guid value);
    307     partial void OnTaskIdChanged();
     322    partial void OnProjectIdChanging(System.Guid value);
     323    partial void OnProjectIdChanged();
    308324    #endregion
    309325   
     
    311327    {
    312328      this._Resource = default(EntityRef<Resource>);
    313       this._Job = default(EntityRef<Task>);
     329      this._Project = default(EntityRef<Project>);
    314330      OnCreated();
    315331    }
     
    340356   
    341357    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_JobId", DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true)]
    342     public System.Guid TaskId
     358    public System.Guid ProjectId
    343359    {
    344360      get
     
    350366        if ((this._JobId != value))
    351367        {
    352           if (this._Job.HasLoadedOrAssignedValue)
     368          if (this._Project.HasLoadedOrAssignedValue)
    353369          {
    354370            throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
    355371          }
    356           this.OnTaskIdChanging(value);
     372          this.OnProjectIdChanging(value);
    357373          this.SendPropertyChanging();
    358374          this._JobId = value;
    359           this.SendPropertyChanged("TaskId");
    360           this.OnTaskIdChanged();
     375          this.SendPropertyChanged("ProjectId");
     376          this.OnProjectIdChanged();
    361377        }
    362378      }
     
    397413    }
    398414   
    399     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Task_AssignedResource", Storage="_Job", ThisKey="TaskId", OtherKey="TaskId", IsForeignKey=true, DeleteRule="CASCADE")]
    400     public Task Task
    401     {
    402       get
    403       {
    404         return this._Job.Entity;
    405       }
    406       set
    407       {
    408         Task previousValue = this._Job.Entity;
     415    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_AssignedResource", Storage="_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true, DeleteRule="CASCADE")]
     416    public Project Project
     417    {
     418      get
     419      {
     420        return this._Project.Entity;
     421      }
     422      set
     423      {
     424        Project previousValue = this._Project.Entity;
    409425        if (((previousValue != value)
    410               || (this._Job.HasLoadedOrAssignedValue == false)))
     426              || (this._Project.HasLoadedOrAssignedValue == false)))
    411427        {
    412428          this.SendPropertyChanging();
    413429          if ((previousValue != null))
    414430          {
    415             this._Job.Entity = null;
     431            this._Project.Entity = null;
    416432            previousValue.AssignedResources.Remove(this);
    417433          }
    418           this._Job.Entity = value;
     434          this._Project.Entity = value;
    419435          if ((value != null))
    420436          {
    421437            value.AssignedResources.Add(this);
    422             this._JobId = value.TaskId;
     438            this._JobId = value.ProjectId;
    423439          }
    424440          else
     
    426442            this._JobId = default(System.Guid);
    427443          }
    428           this.SendPropertyChanged("Task");
     444          this.SendPropertyChanged("Project");
    429445        }
    430446      }
     
    16201636    private System.Guid _HiveExperimentId;
    16211637   
    1622     private EntitySet<AssignedResource> _AssignedResources;
    1623    
    16241638    private EntitySet<RequiredPlugin> _RequiredPlugins;
    16251639   
     
    16661680    public Task()
    16671681    {
    1668       this._AssignedResources = new EntitySet<AssignedResource>(new Action<AssignedResource>(this.attach_AssignedResources), new Action<AssignedResource>(this.detach_AssignedResources));
    16691682      this._RequiredPlugins = new EntitySet<RequiredPlugin>(new Action<RequiredPlugin>(this.attach_RequiredPlugins), new Action<RequiredPlugin>(this.detach_RequiredPlugins));
    16701683      this._Jobs = new EntitySet<Task>(new Action<Task>(this.attach_Jobs), new Action<Task>(this.detach_Jobs));
     
    19241937    }
    19251938   
    1926     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Task_AssignedResource", Storage="_AssignedResources", ThisKey="TaskId", OtherKey="TaskId")]
    1927     public EntitySet<AssignedResource> AssignedResources
    1928     {
    1929       get
    1930       {
    1931         return this._AssignedResources;
    1932       }
    1933       set
    1934       {
    1935         this._AssignedResources.Assign(value);
    1936       }
    1937     }
    1938    
    19391939    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Task_RequiredPlugin", Storage="_RequiredPlugins", ThisKey="TaskId", OtherKey="TaskId")]
    19401940    public EntitySet<RequiredPlugin> RequiredPlugins
     
    20912091        this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
    20922092      }
    2093     }
    2094    
    2095     private void attach_AssignedResources(AssignedResource entity)
    2096     {
    2097       this.SendPropertyChanging();
    2098       entity.Task = this;
    2099     }
    2100    
    2101     private void detach_AssignedResources(AssignedResource entity)
    2102     {
    2103       this.SendPropertyChanging();
    2104       entity.Task = null;
    21052093    }
    21062094   
     
    24312419    private System.DateTime _DateCreated;
    24322420   
     2421    private System.Guid _ProjectId;
     2422   
    24332423    private EntitySet<Task> _Jobs;
    24342424   
    24352425    private EntitySet<JobPermission> _HiveExperimentPermissions;
     2426   
     2427    private EntityRef<Project> _Project;
    24362428   
    24372429    #region Extensibility Method Definitions
     
    24512443    partial void OnDateCreatedChanging(System.DateTime value);
    24522444    partial void OnDateCreatedChanged();
     2445    partial void OnProjectIdChanging(System.Guid value);
     2446    partial void OnProjectIdChanged();
    24532447    #endregion
    24542448   
     
    24572451      this._Jobs = new EntitySet<Task>(new Action<Task>(this.attach_Jobs), new Action<Task>(this.detach_Jobs));
    24582452      this._HiveExperimentPermissions = new EntitySet<JobPermission>(new Action<JobPermission>(this.attach_HiveExperimentPermissions), new Action<JobPermission>(this.detach_HiveExperimentPermissions));
     2453      this._Project = default(EntityRef<Project>);
    24592454      OnCreated();
    24602455    }
     
    25802575    }
    25812576   
     2577    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectId", DbType="UniqueIdentifier NOT NULL")]
     2578    public System.Guid ProjectId
     2579    {
     2580      get
     2581      {
     2582        return this._ProjectId;
     2583      }
     2584      set
     2585      {
     2586        if ((this._ProjectId != value))
     2587        {
     2588          if (this._Project.HasLoadedOrAssignedValue)
     2589          {
     2590            throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
     2591          }
     2592          this.OnProjectIdChanging(value);
     2593          this.SendPropertyChanging();
     2594          this._ProjectId = value;
     2595          this.SendPropertyChanged("ProjectId");
     2596          this.OnProjectIdChanged();
     2597        }
     2598      }
     2599    }
     2600   
    25822601    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_Task", Storage="_Jobs", ThisKey="JobId", OtherKey="JobId")]
    25832602    public EntitySet<Task> Tasks
     
    26032622      {
    26042623        this._HiveExperimentPermissions.Assign(value);
     2624      }
     2625    }
     2626   
     2627    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_Job", Storage="_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true)]
     2628    public Project Project
     2629    {
     2630      get
     2631      {
     2632        return this._Project.Entity;
     2633      }
     2634      set
     2635      {
     2636        Project previousValue = this._Project.Entity;
     2637        if (((previousValue != value)
     2638              || (this._Project.HasLoadedOrAssignedValue == false)))
     2639        {
     2640          this.SendPropertyChanging();
     2641          if ((previousValue != null))
     2642          {
     2643            this._Project.Entity = null;
     2644            previousValue.Jobs.Remove(this);
     2645          }
     2646          this._Project.Entity = value;
     2647          if ((value != null))
     2648          {
     2649            value.Jobs.Add(this);
     2650            this._ProjectId = value.ProjectId;
     2651          }
     2652          else
     2653          {
     2654            this._ProjectId = default(System.Guid);
     2655          }
     2656          this.SendPropertyChanged("Project");
     2657        }
    26052658      }
    26062659    }
     
    52615314    }
    52625315   
    5263     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UserId", DbType="UniqueIdentifier NULL", IsPrimaryKey=true)]
     5316    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UserId", DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true)]
    52645317    public System.Guid UserId
    52655318    {
     
    56075660    }
    56085661  }
     5662 
     5663  [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Project")]
     5664  public partial class Project : INotifyPropertyChanging, INotifyPropertyChanged
     5665  {
     5666   
     5667    private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
     5668   
     5669    private System.Guid _ProjectId;
     5670   
     5671    private System.Nullable<System.Guid> _ParentProjectId;
     5672   
     5673    private System.DateTime _DateCreated;
     5674   
     5675    private string _Name;
     5676   
     5677    private string _Description;
     5678   
     5679    private System.Guid _OwnerUserId;
     5680   
     5681    private System.DateTime _StartDate;
     5682   
     5683    private System.DateTime _EndDate;
     5684   
     5685    private EntitySet<AssignedResource> _AssignedResources;
     5686   
     5687    private EntitySet<Job> _Jobs;
     5688   
     5689    private EntitySet<Project> _Projects;
     5690   
     5691    private EntitySet<ProjectPermission> _ProjectPermissions;
     5692   
     5693    private EntityRef<Project> _Project1;
     5694   
     5695    #region Extensibility Method Definitions
     5696    partial void OnLoaded();
     5697    partial void OnValidate(System.Data.Linq.ChangeAction action);
     5698    partial void OnCreated();
     5699    partial void OnProjectIdChanging(System.Guid value);
     5700    partial void OnProjectIdChanged();
     5701    partial void OnParentProjectIdChanging(System.Nullable<System.Guid> value);
     5702    partial void OnParentProjectIdChanged();
     5703    partial void OnDateCreatedChanging(System.DateTime value);
     5704    partial void OnDateCreatedChanged();
     5705    partial void OnNameChanging(string value);
     5706    partial void OnNameChanged();
     5707    partial void OnDescriptionChanging(string value);
     5708    partial void OnDescriptionChanged();
     5709    partial void OnOwnerUserIdChanging(System.Guid value);
     5710    partial void OnOwnerUserIdChanged();
     5711    partial void OnStartDateChanging(System.DateTime value);
     5712    partial void OnStartDateChanged();
     5713    partial void OnEndDateChanging(System.DateTime value);
     5714    partial void OnEndDateChanged();
     5715    #endregion
     5716   
     5717    public Project()
     5718    {
     5719      this._AssignedResources = new EntitySet<AssignedResource>(new Action<AssignedResource>(this.attach_AssignedResources), new Action<AssignedResource>(this.detach_AssignedResources));
     5720      this._Jobs = new EntitySet<Job>(new Action<Job>(this.attach_Jobs), new Action<Job>(this.detach_Jobs));
     5721      this._Projects = new EntitySet<Project>(new Action<Project>(this.attach_Projects), new Action<Project>(this.detach_Projects));
     5722      this._ProjectPermissions = new EntitySet<ProjectPermission>(new Action<ProjectPermission>(this.attach_ProjectPermissions), new Action<ProjectPermission>(this.detach_ProjectPermissions));
     5723      this._Project1 = default(EntityRef<Project>);
     5724      OnCreated();
     5725    }
     5726   
     5727    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)]
     5728    public System.Guid ProjectId
     5729    {
     5730      get
     5731      {
     5732        return this._ProjectId;
     5733      }
     5734      set
     5735      {
     5736        if ((this._ProjectId != value))
     5737        {
     5738          this.OnProjectIdChanging(value);
     5739          this.SendPropertyChanging();
     5740          this._ProjectId = value;
     5741          this.SendPropertyChanged("ProjectId");
     5742          this.OnProjectIdChanged();
     5743        }
     5744      }
     5745    }
     5746   
     5747    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ParentProjectId", DbType="UniqueIdentifier")]
     5748    public System.Nullable<System.Guid> ParentProjectId
     5749    {
     5750      get
     5751      {
     5752        return this._ParentProjectId;
     5753      }
     5754      set
     5755      {
     5756        if ((this._ParentProjectId != value))
     5757        {
     5758          if (this._Project1.HasLoadedOrAssignedValue)
     5759          {
     5760            throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
     5761          }
     5762          this.OnParentProjectIdChanging(value);
     5763          this.SendPropertyChanging();
     5764          this._ParentProjectId = value;
     5765          this.SendPropertyChanged("ParentProjectId");
     5766          this.OnParentProjectIdChanged();
     5767        }
     5768      }
     5769    }
     5770   
     5771    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DateCreated", DbType="DateTime NOT NULL")]
     5772    public System.DateTime DateCreated
     5773    {
     5774      get
     5775      {
     5776        return this._DateCreated;
     5777      }
     5778      set
     5779      {
     5780        if ((this._DateCreated != value))
     5781        {
     5782          this.OnDateCreatedChanging(value);
     5783          this.SendPropertyChanging();
     5784          this._DateCreated = value;
     5785          this.SendPropertyChanged("DateCreated");
     5786          this.OnDateCreatedChanged();
     5787        }
     5788      }
     5789    }
     5790   
     5791    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Name", DbType="VarChar(MAX)", CanBeNull=false)]
     5792    public string Name
     5793    {
     5794      get
     5795      {
     5796        return this._Name;
     5797      }
     5798      set
     5799      {
     5800        if ((this._Name != value))
     5801        {
     5802          this.OnNameChanging(value);
     5803          this.SendPropertyChanging();
     5804          this._Name = value;
     5805          this.SendPropertyChanged("Name");
     5806          this.OnNameChanged();
     5807        }
     5808      }
     5809    }
     5810   
     5811    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Description", DbType="VarChar(MAX)", CanBeNull=false)]
     5812    public string Description
     5813    {
     5814      get
     5815      {
     5816        return this._Description;
     5817      }
     5818      set
     5819      {
     5820        if ((this._Description != value))
     5821        {
     5822          this.OnDescriptionChanging(value);
     5823          this.SendPropertyChanging();
     5824          this._Description = value;
     5825          this.SendPropertyChanged("Description");
     5826          this.OnDescriptionChanged();
     5827        }
     5828      }
     5829    }
     5830   
     5831    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OwnerUserId", DbType="UniqueIdentifier NOT NULL")]
     5832    public System.Guid OwnerUserId
     5833    {
     5834      get
     5835      {
     5836        return this._OwnerUserId;
     5837      }
     5838      set
     5839      {
     5840        if ((this._OwnerUserId != value))
     5841        {
     5842          this.OnOwnerUserIdChanging(value);
     5843          this.SendPropertyChanging();
     5844          this._OwnerUserId = value;
     5845          this.SendPropertyChanged("OwnerUserId");
     5846          this.OnOwnerUserIdChanged();
     5847        }
     5848      }
     5849    }
     5850   
     5851    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StartDate", DbType="DateTime NOT NULL")]
     5852    public System.DateTime StartDate
     5853    {
     5854      get
     5855      {
     5856        return this._StartDate;
     5857      }
     5858      set
     5859      {
     5860        if ((this._StartDate != value))
     5861        {
     5862          this.OnStartDateChanging(value);
     5863          this.SendPropertyChanging();
     5864          this._StartDate = value;
     5865          this.SendPropertyChanged("StartDate");
     5866          this.OnStartDateChanged();
     5867        }
     5868      }
     5869    }
     5870   
     5871    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_EndDate", DbType="DateTime")]
     5872    public System.DateTime EndDate
     5873    {
     5874      get
     5875      {
     5876        return this._EndDate;
     5877      }
     5878      set
     5879      {
     5880        if ((this._EndDate != value))
     5881        {
     5882          this.OnEndDateChanging(value);
     5883          this.SendPropertyChanging();
     5884          this._EndDate = value;
     5885          this.SendPropertyChanged("EndDate");
     5886          this.OnEndDateChanged();
     5887        }
     5888      }
     5889    }
     5890   
     5891    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_AssignedResource", Storage="_AssignedResources", ThisKey="ProjectId", OtherKey="ProjectId")]
     5892    public EntitySet<AssignedResource> AssignedResources
     5893    {
     5894      get
     5895      {
     5896        return this._AssignedResources;
     5897      }
     5898      set
     5899      {
     5900        this._AssignedResources.Assign(value);
     5901      }
     5902    }
     5903   
     5904    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_Job", Storage="_Jobs", ThisKey="ProjectId", OtherKey="ProjectId")]
     5905    public EntitySet<Job> Jobs
     5906    {
     5907      get
     5908      {
     5909        return this._Jobs;
     5910      }
     5911      set
     5912      {
     5913        this._Jobs.Assign(value);
     5914      }
     5915    }
     5916   
     5917    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_Project", Storage="_Projects", ThisKey="ProjectId", OtherKey="ParentProjectId")]
     5918    public EntitySet<Project> ChildProjects
     5919    {
     5920      get
     5921      {
     5922        return this._Projects;
     5923      }
     5924      set
     5925      {
     5926        this._Projects.Assign(value);
     5927      }
     5928    }
     5929   
     5930    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_ProjectPermission", Storage="_ProjectPermissions", ThisKey="ProjectId", OtherKey="ProjectId")]
     5931    public EntitySet<ProjectPermission> ProjectPermissions
     5932    {
     5933      get
     5934      {
     5935        return this._ProjectPermissions;
     5936      }
     5937      set
     5938      {
     5939        this._ProjectPermissions.Assign(value);
     5940      }
     5941    }
     5942   
     5943    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_Project", Storage="_Project1", ThisKey="ParentProjectId", OtherKey="ProjectId", IsForeignKey=true)]
     5944    public Project ParentProject
     5945    {
     5946      get
     5947      {
     5948        return this._Project1.Entity;
     5949      }
     5950      set
     5951      {
     5952        Project previousValue = this._Project1.Entity;
     5953        if (((previousValue != value)
     5954              || (this._Project1.HasLoadedOrAssignedValue == false)))
     5955        {
     5956          this.SendPropertyChanging();
     5957          if ((previousValue != null))
     5958          {
     5959            this._Project1.Entity = null;
     5960            previousValue.ChildProjects.Remove(this);
     5961          }
     5962          this._Project1.Entity = value;
     5963          if ((value != null))
     5964          {
     5965            value.ChildProjects.Add(this);
     5966            this._ParentProjectId = value.ProjectId;
     5967          }
     5968          else
     5969          {
     5970            this._ParentProjectId = default(Nullable<System.Guid>);
     5971          }
     5972          this.SendPropertyChanged("ParentProject");
     5973        }
     5974      }
     5975    }
     5976   
     5977    public event PropertyChangingEventHandler PropertyChanging;
     5978   
     5979    public event PropertyChangedEventHandler PropertyChanged;
     5980   
     5981    protected virtual void SendPropertyChanging()
     5982    {
     5983      if ((this.PropertyChanging != null))
     5984      {
     5985        this.PropertyChanging(this, emptyChangingEventArgs);
     5986      }
     5987    }
     5988   
     5989    protected virtual void SendPropertyChanged(String propertyName)
     5990    {
     5991      if ((this.PropertyChanged != null))
     5992      {
     5993        this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
     5994      }
     5995    }
     5996   
     5997    private void attach_AssignedResources(AssignedResource entity)
     5998    {
     5999      this.SendPropertyChanging();
     6000      entity.Project = this;
     6001    }
     6002   
     6003    private void detach_AssignedResources(AssignedResource entity)
     6004    {
     6005      this.SendPropertyChanging();
     6006      entity.Project = null;
     6007    }
     6008   
     6009    private void attach_Jobs(Job entity)
     6010    {
     6011      this.SendPropertyChanging();
     6012      entity.Project = this;
     6013    }
     6014   
     6015    private void detach_Jobs(Job entity)
     6016    {
     6017      this.SendPropertyChanging();
     6018      entity.Project = null;
     6019    }
     6020   
     6021    private void attach_Projects(Project entity)
     6022    {
     6023      this.SendPropertyChanging();
     6024      entity.ParentProject = this;
     6025    }
     6026   
     6027    private void detach_Projects(Project entity)
     6028    {
     6029      this.SendPropertyChanging();
     6030      entity.ParentProject = null;
     6031    }
     6032   
     6033    private void attach_ProjectPermissions(ProjectPermission entity)
     6034    {
     6035      this.SendPropertyChanging();
     6036      entity.Project = this;
     6037    }
     6038   
     6039    private void detach_ProjectPermissions(ProjectPermission entity)
     6040    {
     6041      this.SendPropertyChanging();
     6042      entity.Project = null;
     6043    }
     6044  }
     6045 
     6046  [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.ProjectPermission")]
     6047  public partial class ProjectPermission : INotifyPropertyChanging, INotifyPropertyChanged
     6048  {
     6049   
     6050    private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
     6051   
     6052    private System.Guid _ProjectId;
     6053   
     6054    private System.Guid _GrantedUserId;
     6055   
     6056    private System.Guid _GrantedByUserId;
     6057   
     6058    private EntityRef<Project> _Project;
     6059   
     6060    #region Extensibility Method Definitions
     6061    partial void OnLoaded();
     6062    partial void OnValidate(System.Data.Linq.ChangeAction action);
     6063    partial void OnCreated();
     6064    partial void OnProjectIdChanging(System.Guid value);
     6065    partial void OnProjectIdChanged();
     6066    partial void OnGrantedUserIdChanging(System.Guid value);
     6067    partial void OnGrantedUserIdChanged();
     6068    partial void OnGrantedByUserIdChanging(System.Guid value);
     6069    partial void OnGrantedByUserIdChanged();
     6070    #endregion
     6071   
     6072    public ProjectPermission()
     6073    {
     6074      this._Project = default(EntityRef<Project>);
     6075      OnCreated();
     6076    }
     6077   
     6078    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectId", DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true)]
     6079    public System.Guid ProjectId
     6080    {
     6081      get
     6082      {
     6083        return this._ProjectId;
     6084      }
     6085      set
     6086      {
     6087        if ((this._ProjectId != value))
     6088        {
     6089          if (this._Project.HasLoadedOrAssignedValue)
     6090          {
     6091            throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
     6092          }
     6093          this.OnProjectIdChanging(value);
     6094          this.SendPropertyChanging();
     6095          this._ProjectId = value;
     6096          this.SendPropertyChanged("ProjectId");
     6097          this.OnProjectIdChanged();
     6098        }
     6099      }
     6100    }
     6101   
     6102    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_GrantedUserId", DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true)]
     6103    public System.Guid GrantedUserId
     6104    {
     6105      get
     6106      {
     6107        return this._GrantedUserId;
     6108      }
     6109      set
     6110      {
     6111        if ((this._GrantedUserId != value))
     6112        {
     6113          this.OnGrantedUserIdChanging(value);
     6114          this.SendPropertyChanging();
     6115          this._GrantedUserId = value;
     6116          this.SendPropertyChanged("GrantedUserId");
     6117          this.OnGrantedUserIdChanged();
     6118        }
     6119      }
     6120    }
     6121   
     6122    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_GrantedByUserId", DbType="UniqueIdentifier NOT NULL")]
     6123    public System.Guid GrantedByUserId
     6124    {
     6125      get
     6126      {
     6127        return this._GrantedByUserId;
     6128      }
     6129      set
     6130      {
     6131        if ((this._GrantedByUserId != value))
     6132        {
     6133          this.OnGrantedByUserIdChanging(value);
     6134          this.SendPropertyChanging();
     6135          this._GrantedByUserId = value;
     6136          this.SendPropertyChanged("GrantedByUserId");
     6137          this.OnGrantedByUserIdChanged();
     6138        }
     6139      }
     6140    }
     6141   
     6142    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_ProjectPermission", Storage="_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true)]
     6143    public Project Project
     6144    {
     6145      get
     6146      {
     6147        return this._Project.Entity;
     6148      }
     6149      set
     6150      {
     6151        Project previousValue = this._Project.Entity;
     6152        if (((previousValue != value)
     6153              || (this._Project.HasLoadedOrAssignedValue == false)))
     6154        {
     6155          this.SendPropertyChanging();
     6156          if ((previousValue != null))
     6157          {
     6158            this._Project.Entity = null;
     6159            previousValue.ProjectPermissions.Remove(this);
     6160          }
     6161          this._Project.Entity = value;
     6162          if ((value != null))
     6163          {
     6164            value.ProjectPermissions.Add(this);
     6165            this._ProjectId = value.ProjectId;
     6166          }
     6167          else
     6168          {
     6169            this._ProjectId = default(System.Guid);
     6170          }
     6171          this.SendPropertyChanged("Project");
     6172        }
     6173      }
     6174    }
     6175   
     6176    public event PropertyChangingEventHandler PropertyChanging;
     6177   
     6178    public event PropertyChangedEventHandler PropertyChanged;
     6179   
     6180    protected virtual void SendPropertyChanging()
     6181    {
     6182      if ((this.PropertyChanging != null))
     6183      {
     6184        this.PropertyChanging(this, emptyChangingEventArgs);
     6185      }
     6186    }
     6187   
     6188    protected virtual void SendPropertyChanged(String propertyName)
     6189    {
     6190      if ((this.PropertyChanged != null))
     6191      {
     6192        this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
     6193      }
     6194    }
     6195  }
    56096196}
    56106197#pragma warning restore 1591
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/SQL Scripts/Initialize Hive Database.sql

    r14185 r15378  
    2525
    2626SET ARITHABORT ON
    27 CREATE TABLE [dbo].[AssignedResources](
     27
     28CREATE TABLE [dbo].[AssignedResource](
    2829  [ResourceId] UniqueIdentifier NOT NULL,
    29   [TaskId] UniqueIdentifier NOT NULL,
    30   CONSTRAINT [PK_dbo.ResourceIdTaskId] PRIMARY KEY ([ResourceId], [TaskId])
     30  [ProjectId] UniqueIdentifier NOT NULL,
     31  CONSTRAINT [PK_dbo.ResourceIdProjectId] PRIMARY KEY ([ResourceId], [ProjectId])
    3132  )
    3233CREATE TABLE [dbo].[Plugin](
     
    106107  [OwnerUserId] UniqueIdentifier NOT NULL,
    107108  [DateCreated] DateTime NOT NULL,
     109  [ProjectId] UniqueIdentifier NOT NULL,
    108110  CONSTRAINT [PK_dbo.Job] PRIMARY KEY ([JobId])
    109111  )
     
    148150  CONSTRAINT [PK_UserPriority] PRIMARY KEY ([UserId])
    149151  )
    150 ALTER TABLE [dbo].[AssignedResources]
     152CREATE TABLE [dbo].[Project](
     153  [ProjectId] UniqueIdentifier NOT NULL,
     154  [ParentProjectId] UniqueIdentifier,
     155  [DateCreated] DateTime NOT NULL,
     156  [Name] VarChar(MAX) NOT NULL,
     157  [Description] VarChar(MAX) NOT NULL,
     158  [OwnerUserId] UniqueIdentifier NOT NULL,
     159  [StartDate] DateTime NOT NULL,
     160  [EndDate] DateTime,
     161  CONSTRAINT [PK_dbo.Project] PRIMARY KEY ([ProjectId])
     162  )
     163CREATE TABLE [dbo].[ProjectPermission](
     164  [ProjectId] UniqueIdentifier NOT NULL,
     165  [GrantedUserId] UniqueIdentifier NOT NULL,
     166  [GrantedByUserId] UniqueIdentifier NOT NULL,
     167  CONSTRAINT [PK_dbo.ProjectPermission] PRIMARY KEY ([ProjectId], [GrantedUserId])
     168  )
     169
     170ALTER TABLE [dbo].[AssignedResource]
    151171  ADD CONSTRAINT [Resource_AssignedResource] FOREIGN KEY ([ResourceId]) REFERENCES [dbo].[Resource]([ResourceId])
    152 ALTER TABLE [dbo].[AssignedResources]
    153   ADD CONSTRAINT [Task_AssignedResource] FOREIGN KEY ([TaskId]) REFERENCES [dbo].[Task]([TaskId])
     172ALTER TABLE [dbo].[AssignedResource]
     173  ADD CONSTRAINT [Project_AssignedResource] FOREIGN KEY ([ProjectId]) REFERENCES [dbo].[Project]([ProjectId])
    154174ALTER TABLE [dbo].[RequiredPlugins]
    155175  ADD CONSTRAINT [Plugin_RequiredPlugin] FOREIGN KEY ([PluginId]) REFERENCES [dbo].[Plugin]([PluginId])
     
    166186ALTER TABLE [dbo].[Downtime]
    167187  ADD CONSTRAINT [Resource_Downtime] FOREIGN KEY ([ResourceId]) REFERENCES [dbo].[Resource]([ResourceId])
     188ALTER TABLE [dbo].[Job]
     189  ADD CONSTRAINT [Project_Job] FOREIGN KEY ([ProjectId]) REFERENCES [dbo].[Project]([ProjectId])
    168190ALTER TABLE [dbo].[TaskData]
    169191  ADD CONSTRAINT [Task_TaskData] FOREIGN KEY ([TaskId]) REFERENCES [dbo].[Task]([TaskId])
     
    176198ALTER TABLE [dbo].[JobPermission]
    177199  ADD CONSTRAINT [Job_JobPermission] FOREIGN KEY ([JobId]) REFERENCES [dbo].[Job]([JobId])
     200ALTER TABLE [dbo].[Project]
     201  ADD CONSTRAINT [Project_Project] FOREIGN KEY ([ParentProjectId]) REFERENCES [dbo].[Project]([ProjectId])
     202ALTER TABLE [dbo].[ProjectPermission]
     203  ADD CONSTRAINT [Project_ProjectPermission] FOREIGN KEY ([ProjectId]) REFERENCES [dbo].[Project]([ProjectId])
    178204
    179205GO
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/SQL Scripts/Prepare Hive Database.sql

    r14185 r15378  
    2121USE [HeuristicLab.Hive-3.3]
    2222
    23 ALTER TABLE [dbo].[AssignedResources]  DROP  CONSTRAINT [Task_AssignedResource]
    24 ALTER TABLE [dbo].[AssignedResources]  WITH CHECK ADD  CONSTRAINT [Task_AssignedResource] FOREIGN KEY([TaskId])
    25 REFERENCES [dbo].[Task] ([TaskId])
     23ALTER TABLE [dbo].[AssignedResource]  DROP  CONSTRAINT [Project_AssignedResource]
     24ALTER TABLE [dbo].[AssignedResource]  WITH CHECK ADD  CONSTRAINT [Project_AssignedResource] FOREIGN KEY([ProjectId])
     25REFERENCES [dbo].[Project] ([ProjectId])
    2626ON UPDATE CASCADE
    2727ON DELETE CASCADE
    2828GO
    29 ALTER TABLE [dbo].[AssignedResources]  DROP  CONSTRAINT [Resource_AssignedResource]
    30 ALTER TABLE [dbo].[AssignedResources]  WITH CHECK ADD  CONSTRAINT [Resource_AssignedResource] FOREIGN KEY([ResourceId])
     29ALTER TABLE [dbo].[AssignedResource]  DROP  CONSTRAINT [Resource_AssignedResource]
     30ALTER TABLE [dbo].[AssignedResource]  WITH CHECK ADD  CONSTRAINT [Resource_AssignedResource] FOREIGN KEY([ResourceId])
    3131REFERENCES [dbo].[Resource] ([ResourceId])
    3232ON UPDATE CASCADE
     
    8888ALTER TABLE dbo.Job ALTER COLUMN JobId ADD ROWGUIDCOL;
    8989ALTER TABLE dbo.Job WITH NOCHECK ADD CONSTRAINT [DF_Job_JobId] DEFAULT (NEWSEQUENTIALID()) FOR JobId;
     90ALTER TABLE [dbo].[Job]  DROP  CONSTRAINT [Project_Job]
     91ALTER TABLE [dbo].[Job]  WITH CHECK ADD  CONSTRAINT [Project_Job] FOREIGN KEY([ProjectId])
     92REFERENCES [dbo].[Project] ([ProjectId])
     93ON UPDATE CASCADE
     94ON DELETE CASCADE
     95GO
    9096
    9197ALTER TABLE dbo.StateLog ALTER COLUMN StateLogId ADD ROWGUIDCOL;
     
    102108ALTER TABLE [dbo].[ResourcePermission]  WITH CHECK ADD CONSTRAINT [Resource_ResourcePermission] FOREIGN KEY([ResourceId])
    103109REFERENCES [dbo].[Resource] ([ResourceId])
     110ON UPDATE CASCADE
     111ON DELETE CASCADE
     112GO
     113
     114ALTER TABLE dbo.Project ALTER COLUMN ProjectId ADD ROWGUIDCOL;
     115ALTER TABLE dbo.Project WITH NOCHECK ADD CONSTRAINT [DF_Project_ProjectId] DEFAULT (NEWSEQUENTIALID()) FOR ProjectId;
     116
     117ALTER TABLE [dbo].[ProjectPermission]  DROP  CONSTRAINT [Project_ProjectPermission]
     118ALTER TABLE [dbo].[ProjectPermission]  WITH CHECK ADD CONSTRAINT [Project_ProjectPermission] FOREIGN KEY([ProjectId])
     119REFERENCES [dbo].[Project] ([ProjectId])
    104120ON UPDATE CASCADE
    105121ON DELETE CASCADE
Note: See TracChangeset for help on using the changeset viewer.