Deliverables database table - Create
From TaskDepender
(→Description) |
|||
Line 1: | Line 1: | ||
''The creation of the [[Deliverables database table]].'' | ''The creation of the [[Deliverables database table]].'' | ||
− | == | + | == Description == |
− | + | 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]]. | |
− | + | * 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 | + | |
− | * 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 | + | |
− | + | ||
− | + | ||
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, | ||
− | |||
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]] |