From 7578960f91c2385b07a44e051d5d79b72e1e38c9 Mon Sep 17 00:00:00 2001 From: tetragon Date: Sun, 12 Nov 2006 06:55:19 +0000 Subject: Adding tax category support to the db git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@524 4979c152-3d1c-0410-bac9-87ea11338e46 --- sql/legacy/Pg-upgrade-2.6.18-2.6.19.sql | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sql/legacy') diff --git a/sql/legacy/Pg-upgrade-2.6.18-2.6.19.sql b/sql/legacy/Pg-upgrade-2.6.18-2.6.19.sql index 90e7e313..9594f9a0 100644 --- a/sql/legacy/Pg-upgrade-2.6.18-2.6.19.sql +++ b/sql/legacy/Pg-upgrade-2.6.18-2.6.19.sql @@ -43,6 +43,8 @@ ALTER TABLE parts ADD PRIMARY KEY (id); ALTER TABLE partsgroup ADD PRIMARY KEY (id); ALTER TABLE partstax ADD PRIMARY KEY (parts_id, chart_id); +ALTER TABLE partstax ADD FOREIGN KEY (chart_id) REFERENCES chart (id); +ALTER TABLE partstax ADD FOREIGN KEY (parts_id) REFERENCES parts (id); ALTER TABLE pricegroup ADD PRIMARY KEY (id); @@ -132,6 +134,14 @@ INSERT INTO taxmodule ( 1, 'Simple' ); +CREATE TABLE taxcategory ( + taxcategory_id serial PRIMARY KEY, + taxcategoryname text NOT NULL, + taxmodule_id int NOT NULL REFERENCES taxmodule (taxmodule_id) +); + +ALTER TABLE partstax ADD COLUMN taxcategory_id int REFERENCES taxcategory (taxcategory_id); + LOCK tax IN EXCLUSIVE MODE; ALTER TABLE tax ADD COLUMN pass int DEFAULT 0; UPDATE tax SET pass = 0; -- cgit v1.2.3