summaryrefslogtreecommitdiff
path: root/sql/Pg-database.sql
diff options
context:
space:
mode:
authortetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2006-11-12 06:55:19 +0000
committertetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2006-11-12 06:55:19 +0000
commit7578960f91c2385b07a44e051d5d79b72e1e38c9 (patch)
tree82c49891f94824508fe7fb562120fb18202e26e7 /sql/Pg-database.sql
parentd570fc9447f3faa8b4c67eff73d69ef04997dea2 (diff)
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
Diffstat (limited to 'sql/Pg-database.sql')
-rw-r--r--sql/Pg-database.sql23
1 files changed, 17 insertions, 6 deletions
diff --git a/sql/Pg-database.sql b/sql/Pg-database.sql
index 907ce363..b7d23a3d 100644
--- a/sql/Pg-database.sql
+++ b/sql/Pg-database.sql
@@ -241,17 +241,28 @@ CREATE TABLE ap (
terms int2 DEFAULT 0
);
--
-CREATE TABLE partstax (
- parts_id int,
- chart_id int,
- PRIMARY KEY (parts_id, chart_id)
-);
---
CREATE TABLE taxmodule (
taxmodule_id serial PRIMARY KEY,
taxmodulename text NOT NULL
);
--
+CREATE TABLE taxcategory (
+ taxcategory_id serial PRIMARY KEY,
+ taxcategoryname text NOT NULL,
+ taxmodule_id int NOT NULL,
+ FOREIGN KEY taxmodule_id REFERENCES taxmodule (taxmodule_id)
+);
+--
+CREATE TABLE partstax (
+ parts_id int,
+ chart_id int,
+ taxcategory_id int,
+ PRIMARY KEY (parts_id, chart_id),
+ FOREIGN KEY parts_id REFERENCES parts (id),
+ FOREIGN KEY chart_id REFERENCES chart (id),
+ FOREIGN KEY taxcategory_id REFERENCES taxcategory (taxcategory_id)
+);
+--
CREATE TABLE tax (
chart_id int PRIMARY KEY,
rate numeric,