phpcompta-dev
[Top][All Lists]
Advanced

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

[Phpcompta-dev] r620 - trunk/rapport_avance/sql


From: phpcompta-dev
Subject: [Phpcompta-dev] r620 - trunk/rapport_avance/sql
Date: Tue, 17 Dec 2013 13:52:34 +0100 (CET)

Author: danydb
Date: 2013-12-17 13:52:34 +0100 (Tue, 17 Dec 2013)
New Revision: 620

Modified:
   trunk/rapport_avance/sql/2-add-compute.sql
   trunk/rapport_avance/sql/2-listing_compute.sql
   trunk/rapport_avance/sql/2-listing_compute_detail.sql
   trunk/rapport_avance/sql/2-listing_compute_historique.sql
   trunk/rapport_avance/sql/2-trigger.sql
Log:
Fix trouble SQL

Modified: trunk/rapport_avance/sql/2-add-compute.sql
===================================================================
--- trunk/rapport_avance/sql/2-add-compute.sql  2013-12-14 12:43:51 UTC (rev 
619)
+++ trunk/rapport_avance/sql/2-add-compute.sql  2013-12-17 12:52:34 UTC (rev 
620)
@@ -2,5 +2,7 @@
 -- TABLES are :
 -- 1. listing_compute
 -- 2. listing_compute_detail
+-- 2. listing_compute_fiche
+-- 2. listing_compute_historique
 -- 3. listing_condition
 -- 4. listing_compute_fiche

Modified: trunk/rapport_avance/sql/2-listing_compute.sql
===================================================================
--- trunk/rapport_avance/sql/2-listing_compute.sql      2013-12-14 12:43:51 UTC 
(rev 619)
+++ trunk/rapport_avance/sql/2-listing_compute.sql      2013-12-17 12:52:34 UTC 
(rev 620)
@@ -34,13 +34,18 @@
 COMMENT ON COLUMN rapport_advanced.listing_compute.l_keep IS 'If yes, it is 
keeped with N it will deleted';
 
 
--- Trigger: listing_compute_trg on rapport_advanced.listing_compute
-
--- DROP TRIGGER listing_compute_trg ON rapport_advanced.listing_compute;
-
+CREATE OR REPLACE FUNCTION rapport_advanced.listing_compute_trg() 
+ returns trigger 
+ as 
+$_BODY_$
+declare 
+begin
+ NEW.l_timestamp=now() ;
+return NEW;
+end;
+$_BODY_$ LANGUAGE plpgsql;
 CREATE TRIGGER listing_compute_trg
-  BEFORE INSERT OR UPDATE
-  ON rapport_advanced.listing_compute
-  FOR EACH ROW
-  EXECUTE PROCEDURE rapport_advanced.listing_compute_trg();
-
+ BEFORE 
+ INSERT OR UPDATE 
+ on rapport_advanced.listing_compute
+ FOR EACH ROW EXECUTE PROCEDURE rapport_advanced.listing_compute_trg();

Modified: trunk/rapport_avance/sql/2-listing_compute_detail.sql
===================================================================
--- trunk/rapport_avance/sql/2-listing_compute_detail.sql       2013-12-14 
12:43:51 UTC (rev 619)
+++ trunk/rapport_avance/sql/2-listing_compute_detail.sql       2013-12-17 
12:52:34 UTC (rev 620)
@@ -1,9 +1,12 @@
+\set ECHO all
+
+begin;
 ALTER TABLE rapport_advanced.listing_param ADD COLUMN lp_histo integer;
 ALTER TABLE rapport_advanced.listing_param ALTER COLUMN lp_histo SET DEFAULT 0;
 COMMENT ON COLUMN rapport_advanced.listing_param.lp_histo IS '0 : no history 1 
: with history';
--- Table: rapport_advanced.listing_compute_detail
+-- Table: rapport_advanced.listing_compute_detail
 
--- DROP TABLE rapport_advanced.listing_compute_detail;
+-- DROP TABLE rapport_advanced.listing_compute_detail
 
 CREATE TABLE rapport_advanced.listing_compute_detail
 (
@@ -22,17 +25,8 @@
   CONSTRAINT listing_compute_detail_lc_id_fkey FOREIGN KEY (lc_id)
       REFERENCES rapport_advanced.listing_compute (lc_id) MATCH SIMPLE
       ON UPDATE CASCADE ON DELETE CASCADE,
-  CONSTRAINT listing_compute_detail_lp_id_fkey FOREIGN KEY (lp_id)
-      REFERENCES rapport_advanced.listing_param (lp_id) MATCH SIMPLE
-      ON UPDATE SET NULL ON DELETE SET NULL
-)
-WITH (
-  OIDS=FALSE
-);
-ALTER TABLE rapport_advanced.listing_compute_detail
-  OWNER TO phpcompta;
-COMMENT ON TABLE rapport_advanced.listing_compute_detail
-  IS 'Detail of computing listing_param';
+  CONSTRAINT listing_compute_detail_lp_id_fkey FOREIGN KEY (lp_id) REFERENCES 
rapport_advanced.listing_param (lp_id) MATCH SIMPLE ON UPDATE SET NULL ON 
DELETE SET NULL);
+COMMENT ON TABLE rapport_advanced.listing_compute_detail  IS 'Detail of 
computing listing_param';
 COMMENT ON COLUMN rapport_advanced.listing_compute_detail.ld_id IS 'PK';
 COMMENT ON COLUMN rapport_advanced.listing_compute_detail.lc_id IS 'fk to 
listing_compute';
 COMMENT ON COLUMN rapport_advanced.listing_compute_detail.ld_value_date IS 
'Used when computed value is a date';

Modified: trunk/rapport_avance/sql/2-listing_compute_historique.sql
===================================================================
--- trunk/rapport_avance/sql/2-listing_compute_historique.sql   2013-12-14 
12:43:51 UTC (rev 619)
+++ trunk/rapport_avance/sql/2-listing_compute_historique.sql   2013-12-17 
12:52:34 UTC (rev 620)
@@ -5,13 +5,13 @@
 CREATE TABLE rapport_advanced.listing_compute_historique
 (
   lh_id bigserial NOT NULL, -- PK
-  lc_id bigint, -- FK to listing_compute_detail
+  ld_id bigint, -- FK to listing_compute_detail
   jr_id bigint, -- FK to jrn
   CONSTRAINT listing_compute_historique_pkey PRIMARY KEY (lh_id ),
   CONSTRAINT listing_compute_historique_jr_id_fkey FOREIGN KEY (jr_id)
       REFERENCES jrn (jr_id) MATCH SIMPLE
       ON UPDATE CASCADE ON DELETE CASCADE,
-  CONSTRAINT listing_compute_historique_ld_id_fkey FOREIGN KEY (lc_id)
+  CONSTRAINT listing_compute_historique_ld_id_fkey FOREIGN KEY (ld_id)
       REFERENCES rapport_advanced.listing_compute_detail (ld_id) MATCH SIMPLE
       ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY IMMEDIATE
 )
@@ -23,6 +23,5 @@
 COMMENT ON TABLE rapport_advanced.listing_compute_historique
   IS 'Content : history of operation for a detail';
 COMMENT ON COLUMN rapport_advanced.listing_compute_historique.lh_id IS 'PK';
-COMMENT ON COLUMN rapport_advanced.listing_compute_historique.lc_id IS 'FK to 
listing_compute_detail';
+COMMENT ON COLUMN rapport_advanced.listing_compute_historique.ld_id IS 'FK to 
listing_compute_detail';
 COMMENT ON COLUMN rapport_advanced.listing_compute_historique.jr_id IS 'FK to 
jrn';
-

Modified: trunk/rapport_avance/sql/2-trigger.sql
===================================================================
--- trunk/rapport_avance/sql/2-trigger.sql      2013-12-14 12:43:51 UTC (rev 
619)
+++ trunk/rapport_avance/sql/2-trigger.sql      2013-12-17 12:52:34 UTC (rev 
620)
@@ -1,15 +0,0 @@
-CREATE OR REPLACE FUNCTION rapport_advanced.listing_compute_trg() 
- returns trigger 
- as 
-$_BODY_$
-declare 
-begin
- NEW.l_timestamp=now() ;
-return NEW;
-end;
-$_BODY_$ LANGUAGE plpgsql;
-CREATE TRIGGER listing_compute_trg
- BEFORE 
- INSERT OR UPDATE 
- on rapport_advanced.listing_compute
- FOR EACH ROW EXECUTE PROCEDURE rapport_advanced.listing_compute_trg();



---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu



reply via email to

[Prev in Thread] Current Thread [Next in Thread]