diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/Pg-database.sql | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sql/Pg-database.sql b/sql/Pg-database.sql index 3533708e..00d9d86a 100644 --- a/sql/Pg-database.sql +++ b/sql/Pg-database.sql @@ -531,6 +531,9 @@ CREATE TABLE parts ( project_id int, avgcost NUMERIC ); + +CREATE UNIQUE INDEX parts_partnumber_index_u ON parts (partnumber) +WHERE obsolete is false; -- CREATE TABLE assembly ( id int, @@ -622,7 +625,7 @@ CREATE TABLE partstax ( chart_id int, taxcategory_id int, PRIMARY KEY (parts_id, chart_id), - FOREIGN KEY (parts_id) REFERENCES parts (id), + FOREIGN KEY (parts_id) REFERENCES parts (id) on delete cascade, FOREIGN KEY (chart_id) REFERENCES chart (id), FOREIGN KEY (taxcategory_id) REFERENCES taxcategory (taxcategory_id) ); |