summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/Pg-database.sql15
1 files changed, 13 insertions, 2 deletions
diff --git a/sql/Pg-database.sql b/sql/Pg-database.sql
index 85c8df74..bfaf7c75 100644
--- a/sql/Pg-database.sql
+++ b/sql/Pg-database.sql
@@ -781,6 +781,7 @@ insert into batch_class (id,class) values (2,'ar');
insert into batch_class (id,class) values (3,'payment');
insert into batch_class (id,class) values (4,'payment_reversal');
insert into batch_class (id,class) values (5,'gl');
+insert into batch_class (id,class) values (6,'receipt');
SELECT SETVAL('batch_class_id_seq',6);
@@ -795,12 +796,22 @@ CREATE TABLE batch (
created_on date default now()
);
+COMMENT ON batch.batch_class_id IS
+$$ Note that this field is largely used for sorting the vouchers. A given batch is NOT restricted to this type.$$;
+
CREATE TABLE voucher (
- trans_id int,
+ trans_id int REFERENCES transactions(id) NOT NULL,
batch_id int references batch(id) not null,
- id serial primary key
+ id serial NOT NULL,
+ batch_class int references batch_class not null,
+ PRIMARY KEY (batch_class, batch_id, trans_id)
);
+COMMENT ON batch.batch_class IS $$ This is the authoritative class of the
+voucher. $$;
+
+COMMENT ON voucher.id IS $$ This is simply a surrogate key for easy reference.$$;
+
--
create table shipto (
trans_id int,