summaryrefslogtreecommitdiff
path: root/sql/Pg-database.sql
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-06-19 05:33:54 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-06-19 05:33:54 +0000
commit7885aa569253aab2a66ba5a18419b116e29c5053 (patch)
tree4662cac997473b6c37542d40054239fb21f87f15 /sql/Pg-database.sql
parentb4551f601bbb49fc17166f72af869e49f533656b (diff)
Added on-hold flags for invoices and voucher information to db schema.
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1282 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'sql/Pg-database.sql')
-rw-r--r--sql/Pg-database.sql34
1 files changed, 33 insertions, 1 deletions
diff --git a/sql/Pg-database.sql b/sql/Pg-database.sql
index 9430b188..c0e34fdc 100644
--- a/sql/Pg-database.sql
+++ b/sql/Pg-database.sql
@@ -5,6 +5,32 @@ CREATE TABLE transactions (
table_name text
);
+CREATE TABLE batch_class (
+ batch_type varchar primary key
+);
+
+insert into batch_class (batch_type) values ('ap');
+insert into batch_class (batch_type) values ('payment');
+insert into batch_class (batch_type) values ('payment_reversal');
+insert into batch_class (batch_type) values ('gl');
+
+CREATE TABLE batch (
+ id serial,
+ batch_type references batch_class,
+ description
+ approved_on date,
+ approved_by int references employee(id),
+ created_by int references employee(id),
+ locked_by int references session(id),
+ created_on date default now()
+);
+
+CREATE TABLE voucher (
+ trans_id int,
+ batch_id int,
+ id serial primary key
+);
+
-- BEGIN new entity management
CREATE TABLE entity (
id serial PRIMARY KEY,
@@ -228,6 +254,7 @@ CREATE TABLE gl (
transdate date DEFAULT current_date,
person_id integer references person(id),
notes text,
+ approved bool default true;
department_id int default 0
);
--
@@ -290,6 +317,7 @@ CREATE TABLE acc_trans (
project_id int,
memo text,
invoice_id int,
+ approved bool default true,
entry_id SERIAL PRIMARY KEY
);
--
@@ -408,7 +436,9 @@ CREATE TABLE ar (
department_id int default 0,
shipvia text,
language_code varchar(6),
- ponumber text
+ ponumber text,
+ on_hold bool default false,
+ approved bool default true;
);
COMMENT ON COLUMN ar.entity_id IS $$ Used to be customer_id, but customer is now metadata. You need to push to entity $$;
@@ -438,6 +468,8 @@ CREATE TABLE ap (
language_code varchar(6),
ponumber text,
shippingpoint text,
+ on_hold bool default false,
+ approved bool default true;
terms int2 DEFAULT 0
);