summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorlinuxpoet <linuxpoet@4979c152-3d1c-0410-bac9-87ea11338e46>2007-05-20 21:20:11 +0000
committerlinuxpoet <linuxpoet@4979c152-3d1c-0410-bac9-87ea11338e46>2007-05-20 21:20:11 +0000
commit472dac28c894af91a499b2c81c2b679b9a8e1dca (patch)
treebee059f0ea7ca465340b2965546785d9a18df42c /sql
parent739a8e590e0f164f8c210d4e258647e84aad2d07 (diff)
rebuild oe references and add oe_class table
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1228 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'sql')
-rw-r--r--sql/Pg-database.sql14
1 files changed, 11 insertions, 3 deletions
diff --git a/sql/Pg-database.sql b/sql/Pg-database.sql
index 706e82a5..ac0f52d2 100644
--- a/sql/Pg-database.sql
+++ b/sql/Pg-database.sql
@@ -351,8 +351,7 @@ CREATE TABLE oe (
id serial PRIMARY KEY,
ordnumber text,
transdate date default current_date,
- vendor_id int,
- customer_id int,
+ entity_id integer references entity(id) NOT NULL,
amount NUMERIC,
netamount NUMERIC,
reqdate date,
@@ -370,9 +369,18 @@ CREATE TABLE oe (
language_code varchar(6),
ponumber text,
terms int2 DEFAULT 0
+ oe_class_id int references oe_type(id) NOT NULL
);
---- Chris, we need to talk about oe and the relationship between customer_id and vendor_id
+CREATE TABLE oe_class (
+ id smallint unique check(id IN (1,2),
+ oe_class text primary key;
+
+INSERT INTO oe_class(id,oe_class) values (1,'Sales Order');
+INSERT INTO oe_class(id,oe_class) values (2,'Purchase Order');
+
+COMMENT ON TABLE oe_class IS $$ This could probably be done better. But I need to remove the customer_id/vendor_id relationship and instead rely on a classification $$;
+
--
CREATE TABLE orderitems (