Deliverables database table - Create

From TaskDepender
Jump to: navigation, search
(Description)
 
Line 1: Line 1:
 
''The creation of the [[Deliverables database table]].''
 
''The creation of the [[Deliverables database table]].''
  
== Create ==
+
== Description ==
  
When a new project is created, the deliverables table is created. Because of the reference to the task (see [[#Constraints|"Constraints"]], the deliverables table must be created ''after'' the [[Tasks database table|tasks table]].
+
The two constraints for the table can be implemented by by referencing<ref name="referencing>[http://www.sqlite.org/foreignkeys.html#fk_actions Foreign keys - SQLite definition]</ref> these columns to the appropriate columns.This is done as follows:
 
+
* Delete contained deliverable when container is deleted: reference the <tt>ContainerId</tt> column to the <tt>Id</tt> of the [[Tasks database table|tasks table]].
== Constraints ==
+
* Delete cloned deliverable when parent deliverable is deleted: self-reference the <tt>ContainerId</tt> column to the <tt>Id</tt> column.
 
+
The two constraints for the table can be implemented by by [http://www.sqlite.org/foreignkeys.html#fk_actions referencing] these columns to the appropriate columns. This is done as follows:
+
* Delete contained deliverable when container is deleted: reference the <tt>ContainerId</tt> column to the <tt>Id</tt> of the [[Tasks database table|tasks table]].
+
* Delete cloned deliverable when parent deliverable is deleted: self-reference the <tt>ContainerId column to the Id column.
+
 
+
* Set <tt>RecourceId</tt> to <tt>NULL</tt> when recource deleted: reference <tt>RecourceId</tt> to the <tt>Id</tt> in the [[Resources database table|resources table]].
+
  
 
The last two constraints are implemented via [[Creating a cross reference|cross-referencing]] with the [[Connections database table|<tt>Connections</tt> table]]. Consequently, the <tt>ConnectionId</tt> field is added when this table is created.
 
The last two constraints are implemented via [[Creating a cross reference|cross-referencing]] with the [[Connections database table|<tt>Connections</tt> table]]. Consequently, the <tt>ConnectionId</tt> field is added when this table is created.
 +
 +
When a new project is created, the deliverables table is created. Because of the reference to the task (see [[#Constraints|"Constraints"]], the deliverables table must be created ''after'' the [[Tasks database table|tasks table]].
  
 
== SQL statement ==
 
== SQL statement ==
Line 23: Line 19:
 
   Name TEXT,
 
   Name TEXT,
 
   Description TEXT,
 
   Description TEXT,
  Resource TEXT,
 
 
   X INTEGER,
 
   X INTEGER,
 
   Y INTEGER,
 
   Y INTEGER,
Line 30: Line 25:
 
   ContainerId INTEGER REFERENCES Tasks(Id) ON DELETE CASCADE,
 
   ContainerId INTEGER REFERENCES Tasks(Id) ON DELETE CASCADE,
 
   Link TEXT,
 
   Link TEXT,
   Available INTEGER,
+
   Available INTEGER
 
)
 
)
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
== References ==
 +
<references/>
 +
 +
----
 +
* [[Deliverables database table]]
 +
* [[Database]]

Latest revision as of 06:52, 30 November 2011