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

SF.net SVN: ledger-smb:[4736] trunk/sql



Revision: 4736
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4736&view=rev
Author:   einhverfr
Date:     2012-05-20 11:36:31 +0000 (Sun, 20 May 2012)
Log Message:
-----------
All known db creation errors fixed for 1.4 for now

Modified Paths:
--------------
    trunk/sql/Pg-database.sql
    trunk/sql/modules/Business_Unit.sql
    trunk/sql/modules/Employee.sql

Modified: trunk/sql/Pg-database.sql
===================================================================
--- trunk/sql/Pg-database.sql	2012-05-20 08:55:43 UTC (rev 4735)
+++ trunk/sql/Pg-database.sql	2012-05-20 11:36:31 UTC (rev 4736)
@@ -1,4 +1,4 @@
-CREATE LANGUAGE PLPGSQL; -- separate transaction since may already exist
+CREATE LANGUAGE PLPGSQL; -- Remove when 8.4 is no longer supported
 
 begin;
 
@@ -978,7 +978,7 @@
 CREATE TABLE payroll_paid_timeoff (
    employee_id int not null references entity(id),
    pto_class_id int not null references payroll_pto_class(id),
-   report_id int not null references payroll_report(id)),
+   report_id int not null references payroll_report(id),
    amount numeric not null
 );
 
@@ -1444,6 +1444,7 @@
 	
 CREATE UNIQUE INDEX parts_partnumber_index_u ON parts (partnumber) 
 WHERE obsolete is false;
+
 CREATE TABLE invoice (
   id serial PRIMARY KEY,
   trans_id int REFERENCES transactions(id),
@@ -1456,7 +1457,7 @@
   fxsellprice NUMERIC,
   discount numeric,
   assemblyitem bool DEFAULT 'f',
-  unit varchar(),
+  unit varchar,
   deliverydate date,
   serialnumber text,
   notes text

Modified: trunk/sql/modules/Business_Unit.sql
===================================================================
--- trunk/sql/modules/Business_Unit.sql	2012-05-20 08:55:43 UTC (rev 4735)
+++ trunk/sql/modules/Business_Unit.sql	2012-05-20 11:36:31 UTC (rev 4736)
@@ -185,26 +185,26 @@
 CREATE OR REPLACE FUNCTION eca_bu_trigger() RETURNS TRIGGER AS
 $$
 BEGIN
-  IF TG_OP = 'INSERT'
+  IF TG_OP = 'INSERT' THEN
       INSERT INTO business_unit(class_id, description, credit_id)
       VALUES (7 - NEW.entity_class, NEW.meta_number, NEW.id);
-  ELSIF TG_OP = 'UPDATE'
+  ELSIF TG_OP = 'UPDATE' THEN
       IF new.meta_number <> old.meta_number THEN
          UPDATE business_unit SET description = new.meta_number
           WHERE class_id = 7 - NEW.entity_class
                 AND credit_id = new.id;
       END IF;
-  ELSIF TG_OP = 'DELETE'
+  ELSIF TG_OP = 'DELETE'THEN
       DELETE FROM business_unit WHERE class_id = 7 - NEW.entity_class
                   AND credit_id = old_id;
-      RETURN;
+      RETURN OLD;
   END IF;
   RETURN NEW;
 END;
 $$ LANGUAGE PLPGSQL;
 
-DROP TRIGGER IF EXISTS eca_maintain_b_units CASCADE;
-DROP TRIGGER IF EXISTS eca_maintain_b_units_del CASCADE;
+DROP TRIGGER IF EXISTS eca_maintain_b_units ON entity_credit_account;
+DROP TRIGGER IF EXISTS eca_maintain_b_units_del ON entity_credit_account;
 
 CREATE TRIGGER eca_maintain_b_units AFTER INSERT OR UPDATE 
        ON entity_credit_account

Modified: trunk/sql/modules/Employee.sql
===================================================================
--- trunk/sql/modules/Employee.sql	2012-05-20 08:55:43 UTC (rev 4735)
+++ trunk/sql/modules/Employee.sql	2012-05-20 11:36:31 UTC (rev 4736)
@@ -54,6 +54,7 @@
 COMMENT ON FUNCTION employee__get_user(in_entity_id int) IS
 $$ Returns username, user_id, etc. information if the employee is a user.$$;
 
+drop view if exists employees cascade;
 create view employees as
     select 
         s.salutation,

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