Project

General

Profile

« Previous | Next » 

Revision 5234

schemas/vegbien.sql: party: Made it datasource-scoped. Since this creates a recursive fkey, a datasource (a root party) should point to itself in this field, which will happen automatically by setting it to the special value 0.

View differences:

vegbien.my.sql
117 117

  
118 118

  
119 119
--
120
-- Name: party_datasource_id_self_ref(); Type: FUNCTION; Schema: public; Owner: -
121
--
122

  
123

  
124

  
125

  
126
--
120 127
-- Name: place_update_ancestors(); Type: FUNCTION; Schema: public; Owner: -
121 128
--
122 129

  
......
632 639

  
633 640
CREATE TABLE party (
634 641
    party_id int(11) NOT NULL,
642
    datasource_id int(11) NOT NULL,
635 643
    salutation text,
636 644
    givenname text,
637 645
    middlename text,
......
648 656

  
649 657

  
650 658
--
659
-- Name: COLUMN party.datasource_id; Type: COMMENT; Schema: public; Owner: -
660
--
661

  
662

  
663

  
664

  
665
--
651 666
-- Name: placepath; Type: TABLE; Schema: public; Owner: -; Tablespace: 
652 667
--
653 668

  
......
4120 4135

  
4121 4136

  
4122 4137
--
4138
-- Name: party_datasource_id_self_ref; Type: TRIGGER; Schema: public; Owner: -
4139
--
4140

  
4141

  
4142

  
4143

  
4144
--
4123 4145
-- Name: place_update_ancestors; Type: TRIGGER; Schema: public; Owner: -
4124 4146
--
4125 4147

  
......
4629 4651

  
4630 4652

  
4631 4653
--
4654
-- Name: party_datasource_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4655
--
4656

  
4657
ALTER TABLE party
4658
    ADD CONSTRAINT party_datasource_id_fkey FOREIGN KEY (datasource_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
4659

  
4660

  
4661
--
4632 4662
-- Name: partymember_childparty_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4633 4663
--
4634 4664

  

Also available in: Unified diff