[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [1286] trunk/sql/Pg-database.sql



Revision: 1286
          http://svn.sourceforge.net/ledger-smb/?rev=1286&view=rev
Author:   linuxpoet
Date:     2007-06-19 11:58:40 -0700 (Tue, 19 Jun 2007)

Log Message:
-----------
fixed some issues with batch tables

Modified Paths:
--------------
    trunk/sql/Pg-database.sql

Modified: trunk/sql/Pg-database.sql
===================================================================
--- trunk/sql/Pg-database.sql	2007-06-19 06:47:55 UTC (rev 1285)
+++ trunk/sql/Pg-database.sql	2007-06-19 18:58:40 UTC (rev 1286)
@@ -6,24 +6,25 @@
 );
 
 CREATE TABLE batch_class (
+  id serial unique,
   batch_type varchar primary key
 );
 
-insert into batch_class (batch_type) values ('ap');
-insert into batch_class (batch_type) values ('ar');
-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');
+insert into batch_class (batch_class) values ('ap');
+insert into batch_class (batch_class) values ('ar');
+insert into batch_class (batch_class) values ('payment');
+insert into batch_class (batch_class) values ('payment_reversal');
+insert into batch_class (batch_class) 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),
+  id serial unique,
+  batch_class_id references batch_class(id) not null,
+  description text,
+  approved_on date default null,
+  approved_by int references employee(entity_id),
+  created_by int references employee(entity_id),
   locked_by int references session(id),
-  created_on date default now()
+  created_on date default now(),
 );
 
 CREATE TABLE voucher (
@@ -586,8 +587,8 @@
 );
 --
 create table employee (
-  id serial PRIMARY KEY,
-  entity_id integer references entity(id) not null,
+  entity_id integer references entity(id) not null PRIMARY KEY,
+  entity_class integer references entity_class(id) not null check (entity_class = 3)),
   login text,
   startdate date default current_date,
   enddate date,


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.