Changeset d4547fc2ca717194bd02bda7276a0efa26d120d0

Show
Ignore:
Timestamp:
11/04/08 20:23:11 (5 years ago)
Author:
Denish Patel <denish@omniti.com>
git-committer:
Denish Patel <denish@omniti.com> 1225830191 +0000
git-parent:

[ad852cb8546e10444c22e82377d8821d24cfec15]

git-author:
Denish Patel <denish@omniti.com> 1225830191 +0000
Message:

prism.saved_graphs triggers adjustments

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sql/reconnoiter_ddl_dump.sql

    rbe06d4c rd4547fc  
    4141 
    4242SET default_with_oids = false; 
     43 
     44-- 
     45-- Name: graph_templates; Type: TABLE; Schema: prism; Owner: reconnoiter; Tablespace:  
     46-- 
     47 
     48CREATE TABLE graph_templates ( 
     49    templateid uuid NOT NULL, 
     50    title text NOT NULL, 
     51    json text NOT NULL 
     52); 
     53 
     54 
     55ALTER TABLE prism.graph_templates OWNER TO reconnoiter; 
    4356 
    4457-- 
     
    746759 
    747760-- 
    748 -- Name: trig_before_tsvector_saved_graphs(); Type: FUNCTION; Schema: prism; Owner: postgres 
    749 -- 
    750  
    751 CREATE FUNCTION trig_before_tsvector_saved_graphs() RETURNS trigger 
    752     AS $$ 
    753 DECLARE 
    754  BEGIN 
    755    NEW.ts_search_all:= to_tsvector(NEW.title); 
    756      RETURN NEW; 
    757  END 
    758 $$ 
    759     LANGUAGE plpgsql; 
    760  
    761  
    762 ALTER FUNCTION prism.trig_before_tsvector_saved_graphs() OWNER TO postgres; 
    763  
    764 -- 
    765761-- Name: trig_update_tsvector_saved_graphs(); Type: FUNCTION; Schema: prism; Owner: reconnoiter 
    766762-- 
     
    770766DECLARE 
    771767 BEGIN 
     768 IF TG_OP = 'UPDATE' THEN 
    772769   IF (NEW.graph_tags <> OLD.graph_tags OR NEW.title <> OLD.title) THEN 
    773            UPDATE prism.saved_graphs SET ts_search_all=prism.saved_graphs_tsvector(NEW.graphid) where graphid=NEW.graphid; 
     770           NEW.ts_search_all=prism.saved_graphs_tsvector(NEW.graphid);  
    774771   END IF;     
     772 ELSE 
     773     NEW.ts_search_all = to_tsvector(NEW.title);  
     774 END IF;   
    775775   RETURN NEW; 
    776776END 
     
    21672167 
    21682168-- 
     2169-- Name: graph_templates_pkey; Type: CONSTRAINT; Schema: prism; Owner: reconnoiter; Tablespace:  
     2170-- 
     2171 
     2172ALTER TABLE ONLY graph_templates 
     2173    ADD CONSTRAINT graph_templates_pkey PRIMARY KEY (templateid); 
     2174 
     2175 
     2176-- 
     2177-- Name: graph_templates_title_key; Type: CONSTRAINT; Schema: prism; Owner: reconnoiter; Tablespace:  
     2178-- 
     2179 
     2180ALTER TABLE ONLY graph_templates 
     2181    ADD CONSTRAINT graph_templates_title_key UNIQUE (title); 
     2182 
     2183 
     2184-- 
    21692185-- Name: saved_graphs_dep_pkey; Type: CONSTRAINT; Schema: prism; Owner: reconnoiter; Tablespace:  
    21702186-- 
     
    21802196ALTER TABLE ONLY saved_graphs 
    21812197    ADD CONSTRAINT saved_graphs_pkey PRIMARY KEY (graphid); 
     2198 
     2199 
     2200-- 
     2201-- Name: saved_graphs_title_key; Type: CONSTRAINT; Schema: prism; Owner: reconnoiter; Tablespace:  
     2202-- 
     2203 
     2204ALTER TABLE ONLY saved_graphs 
     2205    ADD CONSTRAINT saved_graphs_title_key UNIQUE (title); 
    21822206 
    21832207 
     
    24882512 
    24892513-- 
    2490 -- Name: trig_before_tsvector_saved_graphs; Type: TRIGGER; Schema: prism; Owner: reconnoiter 
    2491 -- 
    2492  
    2493 CREATE TRIGGER trig_before_tsvector_saved_graphs 
    2494     BEFORE INSERT ON saved_graphs 
    2495     FOR EACH ROW 
    2496     EXECUTE PROCEDURE trig_before_tsvector_saved_graphs(); 
    2497  
    2498  
    2499 -- 
    25002514-- Name: trig_update_tsvector_saved_graphs; Type: TRIGGER; Schema: prism; Owner: reconnoiter 
    25012515-- 
    25022516 
    25032517CREATE TRIGGER trig_update_tsvector_saved_graphs 
    2504     AFTER UPDATE ON saved_graphs 
     2518    BEFORE INSERT OR UPDATE ON saved_graphs 
    25052519    FOR EACH ROW 
    25062520    EXECUTE PROCEDURE trig_update_tsvector_saved_graphs(); 
     
    25822596 
    25832597-- 
    2584 -- Name: graphid_fk; Type: FK CONSTRAINT; Schema: prism; Owner: reconnoiter 
     2598-- Name: saved_graphs_dep_graphid_fkey; Type: FK CONSTRAINT; Schema: prism; Owner: reconnoiter 
    25852599-- 
    25862600 
    25872601ALTER TABLE ONLY saved_graphs_dep 
    2588     ADD CONSTRAINT graphid_fk FOREIGN KEY (graphid) REFERENCES saved_graphs(graphid)
     2602    ADD CONSTRAINT saved_graphs_dep_graphid_fkey FOREIGN KEY (graphid) REFERENCES saved_graphs(graphid) ON DELETE CASCADE
    25892603 
    25902604 
     
    26342648 
    26352649-- 
     2650-- Name: graph_templates; Type: ACL; Schema: prism; Owner: reconnoiter 
     2651-- 
     2652 
     2653REVOKE ALL ON TABLE graph_templates FROM PUBLIC; 
     2654REVOKE ALL ON TABLE graph_templates FROM reconnoiter; 
     2655GRANT ALL ON TABLE graph_templates TO reconnoiter; 
     2656GRANT ALL ON TABLE graph_templates TO prism; 
     2657 
     2658 
     2659-- 
    26362660-- Name: saved_graphs; Type: ACL; Schema: prism; Owner: reconnoiter 
    26372661-- 
     
    26512675GRANT ALL ON TABLE saved_graphs_dep TO reconnoiter; 
    26522676GRANT ALL ON TABLE saved_graphs_dep TO prism; 
     2677 
     2678 
     2679-- 
     2680-- Name: saved_worksheets; Type: ACL; Schema: prism; Owner: reconnoiter 
     2681-- 
     2682 
     2683REVOKE ALL ON TABLE saved_worksheets FROM PUBLIC; 
     2684REVOKE ALL ON TABLE saved_worksheets FROM reconnoiter; 
     2685GRANT ALL ON TABLE saved_worksheets TO reconnoiter; 
     2686GRANT ALL ON TABLE saved_worksheets TO prism; 
     2687 
     2688 
     2689-- 
     2690-- Name: saved_worksheets_dep; Type: ACL; Schema: prism; Owner: reconnoiter 
     2691-- 
     2692 
     2693REVOKE ALL ON TABLE saved_worksheets_dep FROM PUBLIC; 
     2694REVOKE ALL ON TABLE saved_worksheets_dep FROM reconnoiter; 
     2695GRANT ALL ON TABLE saved_worksheets_dep TO reconnoiter; 
     2696GRANT ALL ON TABLE saved_worksheets_dep TO prism; 
    26532697 
    26542698